Skip to content

Commit a429dd1

Browse files
authored
Fix introspection test on SmallAutoField (#287)
* add `SQL_SMALLAUTOFIELD` * unskip test
1 parent 31e2895 commit a429dd1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

mssql/introspection.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
SQL_AUTOFIELD = -777555
1515
SQL_BIGAUTOFIELD = -777444
16+
SQL_SMALLAUTOFIELD = -777333
1617
SQL_TIMESTAMP_WITH_TIMEZONE = -155
1718

1819

@@ -25,6 +26,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
2526
data_types_reverse = {
2627
SQL_AUTOFIELD: 'AutoField',
2728
SQL_BIGAUTOFIELD: 'BigAutoField',
29+
SQL_SMALLAUTOFIELD: 'SmallAutoField',
2830
Database.SQL_BIGINT: 'BigIntegerField',
2931
# Database.SQL_BINARY: ,
3032
Database.SQL_BIT: 'BooleanField',
@@ -130,6 +132,8 @@ def get_table_description(self, cursor, table_name, identity_check=True):
130132
if identity_check and self._is_auto_field(cursor, table_name, column[0]):
131133
if column[1] == Database.SQL_BIGINT:
132134
column[1] = SQL_BIGAUTOFIELD
135+
elif column[1] == Database.SQL_SMALLINT:
136+
column[1] = SQL_SMALLAUTOFIELD
133137
else:
134138
column[1] = SQL_AUTOFIELD
135139
if column[1] == Database.SQL_WVARCHAR and column[3] < 4000:

testapp/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@
159159
'queries.test_db_returning.ReturningValuesTests.test_insert_returning',
160160
'queries.test_db_returning.ReturningValuesTests.test_insert_returning_non_integer',
161161
'backends.tests.BackendTestCase.test_queries',
162-
'introspection.tests.IntrospectionTests.test_smallautofield',
163162
'schema.tests.SchemaTests.test_inline_fk',
164163
'aggregation.tests.AggregateTestCase.test_aggregation_subquery_annotation_exists',
165164
'aggregation.tests.AggregateTestCase.test_aggregation_subquery_annotation_values_collision',

0 commit comments

Comments
 (0)