diff options
| author | Jacob Walls <jacobtylerwalls@gmail.com> | 2021-12-28 10:46:42 -0500 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-12-30 06:36:55 +0100 |
| commit | 92412aa94c97b5c36387fadb39d9f8edf25547fa (patch) | |
| tree | 7083e59f0f95508386ca757f20a3e3a4ec659b6c /tests/migrations/test_executor.py | |
| parent | 361bb8f786f112ee275be136795c0b1ecefff928 (diff) | |
Fixed #23273 -- Avoided creation of django_migrations table when there are no migrations to apply.
Diffstat (limited to 'tests/migrations/test_executor.py')
| -rw-r--r-- | tests/migrations/test_executor.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/migrations/test_executor.py b/tests/migrations/test_executor.py index ca2c03cac5..cab6ac6cb5 100644 --- a/tests/migrations/test_executor.py +++ b/tests/migrations/test_executor.py @@ -759,6 +759,17 @@ class ExecutorTests(MigrationTestBase): False, ) + @mock.patch.object(MigrationRecorder, 'has_table', return_value=False) + def test_migrate_skips_schema_creation(self, mocked_has_table): + """ + The django_migrations table is not created if there are no migrations + to record. + """ + executor = MigrationExecutor(connection) + # 0 queries, since the query for has_table is being mocked. + with self.assertNumQueries(0): + executor.migrate([], plan=[]) + class FakeLoader: def __init__(self, graph, applied): |
