Skip to content

Commit 37fb20e

Browse files
committed
import changes from Django 1.11.1
1 parent 4df37f3 commit 37fb20e

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Microsoft SQL Server and Azure SQL Database.
1717
Features
1818
--------
1919

20-
- Supports Django 1.11.0
20+
- Supports Django 1.11.1
2121
- Supports Microsoft SQL Server 2005, 2008/2008R2, 2012, 2014, 2016 and
2222
Azure SQL Database
2323
- Supports LIMIT+OFFSET and offset w/o LIMIT emulation.
@@ -31,7 +31,7 @@ Features
3131
Dependencies
3232
------------
3333

34-
- Django 1.11.0
34+
- Django 1.11.1
3535
- pyodbc 3.0 or newer
3636

3737
Installation

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
setup(
2121
name='django-pyodbc-azure',
22-
version='1.11.0.0',
22+
version='1.11.1.0',
2323
description='Django backend for Microsoft SQL Server and Azure SQL Database using pyodbc',
2424
long_description=open('README.rst').read(),
2525
author='Michiya Takahashi',
@@ -28,7 +28,7 @@
2828
license='BSD',
2929
packages=['sql_server', 'sql_server.pyodbc'],
3030
install_requires=[
31-
'Django>=1.11,<1.12',
31+
'Django>=1.11.1,<1.12',
3232
'pyodbc>=3.0',
3333
],
3434
classifiers=CLASSIFIERS,

sql_server/pyodbc/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from django.core.exceptions import ImproperlyConfigured
99
from django import VERSION
10-
if VERSION[:3] < (1,11,0) or VERSION[:2] >= (1,12):
10+
if VERSION[:3] < (1,11,1) or VERSION[:2] >= (1,12):
1111
raise ImproperlyConfigured("Django %d.%d.%d is not supported." % VERSION[:3])
1212

1313
try:

sql_server/pyodbc/schema.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from django.db.backends.base.schema import (
55
BaseDatabaseSchemaEditor, logger, _related_non_m2m_objects,
66
)
7+
from django.db.models import Index
78
from django.db.models.fields import AutoField, BigAutoField
89
from django.db.models.fields.related import ManyToManyField
910
from django.db.transaction import TransactionManagementError
@@ -111,8 +112,16 @@ def _alter_field(self, model, old_field, new_field, old_type, new_type,
111112
# True | False | True | True
112113
if old_field.db_index and not old_field.unique and (not new_field.db_index or new_field.unique):
113114
# Find the index for this field
114-
index_names = self._constraint_names(model, [old_field.column], index=True)
115+
meta_index_names = {index.name for index in model._meta.indexes}
116+
# Retrieve only BTREE indexes since this is what's created with
117+
# db_index=True.
118+
index_names = self._constraint_names(model, [old_field.column], index=True, type_=Index.suffix)
115119
for index_name in index_names:
120+
if index_name in meta_index_names:
121+
# The only way to check if an index was created with
122+
# db_index=True or with Index(['field'], name='foo')
123+
# is to look at its name (refs #28053).
124+
continue
116125
self.execute(self._delete_constraint_sql(self.sql_delete_index, model, index_name))
117126
# Change check constraints?
118127
if old_db_params['check'] != new_db_params['check'] and old_db_params['check']:

0 commit comments

Comments
 (0)