mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #23273 -- Avoided creation of django_migrations table when there are no migrations to apply.
This commit is contained in:
committed by
Mariusz Felisiak
parent
361bb8f786
commit
92412aa94c
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user