1212except ImportError as e :
1313 raise ImproperlyConfigured ("Error loading pyodbc module: %s" % e )
1414
15- from django .utils .version import get_version_tuple # noqa
15+ from django .utils .version import get_version_tuple # noqa
1616
1717pyodbc_ver = get_version_tuple (Database .version )
1818if pyodbc_ver < (3 , 0 ):
1919 raise ImproperlyConfigured ("pyodbc 3.0 or newer is required; you have %s" % Database .version )
2020
21- from django .conf import settings # noqa
22- from django .db import NotSupportedError # noqa
23- from django .db .backends .base .base import BaseDatabaseWrapper # noqa
24- from django .utils .encoding import smart_str # noqa
25- from django .utils .functional import cached_property # noqa
21+ from django .conf import settings # noqa
22+ from django .db import NotSupportedError # noqa
23+ from django .db .backends .base .base import BaseDatabaseWrapper # noqa
24+ from django .utils .encoding import smart_str # noqa
25+ from django .utils .functional import cached_property # noqa
2626
2727if hasattr (settings , 'DATABASE_CONNECTION_POOLING' ):
2828 if not settings .DATABASE_CONNECTION_POOLING :
2929 Database .pooling = False
3030
31- from .client import DatabaseClient # noqa
32- from .creation import DatabaseCreation # noqa
33- from .features import DatabaseFeatures # noqa
34- from .introspection import DatabaseIntrospection # noqa
35- from .operations import DatabaseOperations # noqa
36- from .schema import DatabaseSchemaEditor # noqa
31+ from .client import DatabaseClient # noqa
32+ from .creation import DatabaseCreation # noqa
33+ from .features import DatabaseFeatures # noqa
34+ from .introspection import DatabaseIntrospection # noqa
35+ from .operations import DatabaseOperations # noqa
36+ from .schema import DatabaseSchemaEditor # noqa
3737
3838EDITION_AZURE_SQL_DB = 5
3939
@@ -69,8 +69,8 @@ class DatabaseWrapper(BaseDatabaseWrapper):
6969 # be interpolated against the values of Field.__dict__ before being output.
7070 # If a column type is set to None, it won't be included in the output.
7171 data_types = {
72- 'AutoField' : 'int IDENTITY (1, 1) ' ,
73- 'BigAutoField' : 'bigint IDENTITY (1, 1) ' ,
72+ 'AutoField' : 'int' ,
73+ 'BigAutoField' : 'bigint' ,
7474 'BigIntegerField' : 'bigint' ,
7575 'BinaryField' : 'varbinary(max)' ,
7676 'BooleanField' : 'bit' ,
@@ -90,12 +90,17 @@ class DatabaseWrapper(BaseDatabaseWrapper):
9090 'PositiveIntegerField' : 'int' ,
9191 'PositiveSmallIntegerField' : 'smallint' ,
9292 'SlugField' : 'nvarchar(%(max_length)s)' ,
93- 'SmallAutoField' : 'smallint IDENTITY (1, 1) ' ,
93+ 'SmallAutoField' : 'smallint' ,
9494 'SmallIntegerField' : 'smallint' ,
9595 'TextField' : 'nvarchar(max)' ,
9696 'TimeField' : 'time' ,
9797 'UUIDField' : 'char(32)' ,
9898 }
99+ data_types_suffix = {
100+ 'AutoField' : 'IDENTITY (1, 1)' ,
101+ 'BigAutoField' : 'IDENTITY (1, 1)' ,
102+ 'SmallAutoField' : 'IDENTITY (1, 1)' ,
103+ }
99104 data_type_check_constraints = {
100105 'PositiveIntegerField' : '[%(column)s] >= 0' ,
101106 'PositiveSmallIntegerField' : '[%(column)s] >= 0' ,
0 commit comments