Skip to content

Commit c373dfa

Browse files
committed
Disable check for existing data after enable constraint checking
Django expect database not to check existing data after enable constraint checking, This also fixed two errors in backends unit test.
1 parent b37cecf commit c373dfa

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

mssql/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ def disable_constraint_checking(self):
494494

495495
def enable_constraint_checking(self):
496496
if not self.needs_rollback:
497-
self.cursor().execute('EXEC sp_msforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT ALL"')
497+
self.cursor().execute('EXEC sp_msforeachtable "ALTER TABLE ? WITH NOCHECK CHECK CONSTRAINT ALL"')
498498

499499

500500
class CursorWrapper(object):

testapp/settings.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@
101101
'ordering.tests.OrderingTests.test_deprecated_values_annotate',
102102
'queries.test_qs_combinators.QuerySetSetOperationTests.test_limits',
103103
'backends.tests.BackendTestCase.test_unicode_password',
104-
'backends.tests.FkConstraintsTests.test_disable_constraint_checks_context_manager',
105-
'backends.tests.FkConstraintsTests.test_disable_constraint_checks_manually',
106104
'introspection.tests.IntrospectionTests.test_get_table_description_types',
107105
'migrations.test_commands.MigrateTests.test_migrate_syncdb_app_label',
108106
'migrations.test_commands.MigrateTests.test_migrate_syncdb_deferred_sql_executed_with_schemaeditor',

0 commit comments

Comments
 (0)