mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +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",
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
pass
|
|
@ -0,0 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
replaces = [
|
||||
("migrations", "0001_initial"),
|
||||
("migrations", "0002_second"),
|
||||
]
|
|
@ -0,0 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [("migrations", "0001_initial")]
|
|
@ -0,0 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [("migrations", "0002_second")]
|
Loading…
Add table
Add a link
Reference in a new issue