mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #27004 -- Made migrations consistency check ignore unapplied squashed migrations.
This commit is contained in:
parent
42f9d65107
commit
d117567c7d
8 changed files with 61 additions and 0 deletions
|
@ -381,6 +381,23 @@ class LoaderTests(TestCase):
|
|||
with self.assertRaisesMessage(InconsistentMigrationHistory, msg):
|
||||
loader.check_consistent_history(connection)
|
||||
|
||||
@override_settings(
|
||||
MIGRATION_MODULES={'migrations': 'migrations.test_migrations_squashed_extra'},
|
||||
INSTALLED_APPS=['migrations'],
|
||||
)
|
||||
def test_check_consistent_history_squashed(self):
|
||||
"""
|
||||
MigrationLoader.check_consistent_history() should ignore unapplied
|
||||
squashed migrations that have all of their `replaces` applied.
|
||||
"""
|
||||
loader = MigrationLoader(connection=None)
|
||||
recorder = MigrationRecorder(connection)
|
||||
recorder.record_applied('migrations', '0001_initial')
|
||||
recorder.record_applied('migrations', '0002_second')
|
||||
loader.check_consistent_history(connection)
|
||||
recorder.record_applied('migrations', '0003_third')
|
||||
loader.check_consistent_history(connection)
|
||||
|
||||
@override_settings(MIGRATION_MODULES={
|
||||
"app1": "migrations.test_migrations_squashed_ref_squashed.app1",
|
||||
"app2": "migrations.test_migrations_squashed_ref_squashed.app2",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue