Loading django/contrib/gis/tests/gis_migrations/test_commands.py +2 −2 Original line number Diff line number Diff line Loading @@ -21,11 +21,11 @@ class MigrateTests(TransactionTestCase): def assertTableExists(self, table): with connection.cursor() as cursor: self.assertIn(table, connection.introspection.get_table_list(cursor)) self.assertIn(table, connection.introspection.table_names(cursor)) def assertTableNotExists(self, table): with connection.cursor() as cursor: self.assertNotIn(table, connection.introspection.get_table_list(cursor)) self.assertNotIn(table, connection.introspection.table_names(cursor)) @override_system_checks([]) @override_settings(MIGRATION_MODULES={"gis": "django.contrib.gis.tests.gis_migrations.migrations"}) Loading django/db/migrations/executor.py +1 −1 Original line number Diff line number Diff line Loading @@ -149,7 +149,7 @@ class MigrationExecutor(object): # We have to fetch the model to test with from the # main app cache, as it's not a direct dependency. model = global_apps.get_model(model._meta.swapped) if model._meta.db_table not in self.connection.introspection.get_table_list(self.connection.cursor()): if model._meta.db_table not in self.connection.introspection.table_names(self.connection.cursor()): return False found_create_migration = True # If we get this far and we found at least one CreateModel migration, Loading django/db/migrations/recorder.py +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ class MigrationRecorder(object): """ # If the table's there, that's fine - we've never changed its schema # in the codebase. if self.Migration._meta.db_table in self.connection.introspection.get_table_list(self.connection.cursor()): if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()): return # Make the table with self.connection.schema_editor() as editor: Loading tests/migrations/test_base.py +2 −2 Original line number Diff line number Diff line Loading @@ -15,11 +15,11 @@ class MigrationTestBase(TransactionTestCase): def assertTableExists(self, table): with connection.cursor() as cursor: self.assertIn(table, connection.introspection.get_table_list(cursor)) self.assertIn(table, connection.introspection.table_names(cursor)) def assertTableNotExists(self, table): with connection.cursor() as cursor: self.assertNotIn(table, connection.introspection.get_table_list(cursor)) self.assertNotIn(table, connection.introspection.table_names(cursor)) def assertColumnExists(self, table, column): self.assertIn(column, [c.name for c in self.get_table_description(table)]) Loading tests/migrations/test_executor.py +4 −4 Original line number Diff line number Diff line Loading @@ -213,18 +213,18 @@ class ExecutorTests(MigrationTestBase): self.assertTableExists("migrations_author") self.assertTableExists("migrations_tribble") # Make sure the soft-application detection works (#23093) # Change get_table_list to not return auth_user during this as # Change table_names to not return auth_user during this as # it wouldn't be there in a normal run, and ensure migrations.Author # exists in the global app registry temporarily. old_get_table_list = connection.introspection.get_table_list connection.introspection.get_table_list = lambda c: [x for x in old_get_table_list(c) if x != "auth_user"] old_table_names = connection.introspection.table_names connection.introspection.table_names = lambda c: [x for x in old_table_names(c) if x != "auth_user"] migrations_apps = executor.loader.project_state(("migrations", "0001_initial")).render() global_apps.get_app_config("migrations").models["author"] = migrations_apps.get_model("migrations", "author") try: migration = executor.loader.get_migration("auth", "0001_initial") self.assertEqual(executor.detect_soft_applied(migration), True) finally: connection.introspection.get_table_list = old_get_table_list connection.introspection.table_names = old_table_names del global_apps.get_app_config("migrations").models["author"] # And migrate back to clean up the database executor.loader.build_graph() Loading Loading
django/contrib/gis/tests/gis_migrations/test_commands.py +2 −2 Original line number Diff line number Diff line Loading @@ -21,11 +21,11 @@ class MigrateTests(TransactionTestCase): def assertTableExists(self, table): with connection.cursor() as cursor: self.assertIn(table, connection.introspection.get_table_list(cursor)) self.assertIn(table, connection.introspection.table_names(cursor)) def assertTableNotExists(self, table): with connection.cursor() as cursor: self.assertNotIn(table, connection.introspection.get_table_list(cursor)) self.assertNotIn(table, connection.introspection.table_names(cursor)) @override_system_checks([]) @override_settings(MIGRATION_MODULES={"gis": "django.contrib.gis.tests.gis_migrations.migrations"}) Loading
django/db/migrations/executor.py +1 −1 Original line number Diff line number Diff line Loading @@ -149,7 +149,7 @@ class MigrationExecutor(object): # We have to fetch the model to test with from the # main app cache, as it's not a direct dependency. model = global_apps.get_model(model._meta.swapped) if model._meta.db_table not in self.connection.introspection.get_table_list(self.connection.cursor()): if model._meta.db_table not in self.connection.introspection.table_names(self.connection.cursor()): return False found_create_migration = True # If we get this far and we found at least one CreateModel migration, Loading
django/db/migrations/recorder.py +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ class MigrationRecorder(object): """ # If the table's there, that's fine - we've never changed its schema # in the codebase. if self.Migration._meta.db_table in self.connection.introspection.get_table_list(self.connection.cursor()): if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()): return # Make the table with self.connection.schema_editor() as editor: Loading
tests/migrations/test_base.py +2 −2 Original line number Diff line number Diff line Loading @@ -15,11 +15,11 @@ class MigrationTestBase(TransactionTestCase): def assertTableExists(self, table): with connection.cursor() as cursor: self.assertIn(table, connection.introspection.get_table_list(cursor)) self.assertIn(table, connection.introspection.table_names(cursor)) def assertTableNotExists(self, table): with connection.cursor() as cursor: self.assertNotIn(table, connection.introspection.get_table_list(cursor)) self.assertNotIn(table, connection.introspection.table_names(cursor)) def assertColumnExists(self, table, column): self.assertIn(column, [c.name for c in self.get_table_description(table)]) Loading
tests/migrations/test_executor.py +4 −4 Original line number Diff line number Diff line Loading @@ -213,18 +213,18 @@ class ExecutorTests(MigrationTestBase): self.assertTableExists("migrations_author") self.assertTableExists("migrations_tribble") # Make sure the soft-application detection works (#23093) # Change get_table_list to not return auth_user during this as # Change table_names to not return auth_user during this as # it wouldn't be there in a normal run, and ensure migrations.Author # exists in the global app registry temporarily. old_get_table_list = connection.introspection.get_table_list connection.introspection.get_table_list = lambda c: [x for x in old_get_table_list(c) if x != "auth_user"] old_table_names = connection.introspection.table_names connection.introspection.table_names = lambda c: [x for x in old_table_names(c) if x != "auth_user"] migrations_apps = executor.loader.project_state(("migrations", "0001_initial")).render() global_apps.get_app_config("migrations").models["author"] = migrations_apps.get_model("migrations", "author") try: migration = executor.loader.get_migration("auth", "0001_initial") self.assertEqual(executor.detect_soft_applied(migration), True) finally: connection.introspection.get_table_list = old_get_table_list connection.introspection.table_names = old_table_names del global_apps.get_app_config("migrations").models["author"] # And migrate back to clean up the database executor.loader.build_graph() Loading