mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #28363 -- Allowed naming the migration generated by squashmigrations.
This commit is contained in:
committed by
Tim Graham
parent
5ccbcc5bf6
commit
5bb9b9a388
@@ -1356,3 +1356,25 @@ class SquashMigrationsTests(MigrationTestBase):
|
||||
)
|
||||
with self.assertRaisesMessage(CommandError, msg):
|
||||
call_command("squashmigrations", "migrations", "0003", "0002", interactive=False, verbosity=0)
|
||||
|
||||
def test_squashed_name_with_start_migration_name(self):
|
||||
"""--squashed-name specifies the new migration's name."""
|
||||
squashed_name = 'squashed_name'
|
||||
with self.temporary_migration_module(module='migrations.test_migrations') as migration_dir:
|
||||
call_command(
|
||||
'squashmigrations', 'migrations', '0001', '0002',
|
||||
squashed_name=squashed_name, interactive=False, verbosity=0,
|
||||
)
|
||||
squashed_migration_file = os.path.join(migration_dir, '0001_%s.py' % squashed_name)
|
||||
self.assertTrue(os.path.exists(squashed_migration_file))
|
||||
|
||||
def test_squashed_name_without_start_migration_name(self):
|
||||
"""--squashed-name also works if a start migration is omitted."""
|
||||
squashed_name = 'squashed_name'
|
||||
with self.temporary_migration_module(module="migrations.test_migrations") as migration_dir:
|
||||
call_command(
|
||||
'squashmigrations', 'migrations', '0001',
|
||||
squashed_name=squashed_name, interactive=False, verbosity=0,
|
||||
)
|
||||
squashed_migration_file = os.path.join(migration_dir, '0001_%s.py' % squashed_name)
|
||||
self.assertTrue(os.path.exists(squashed_migration_file))
|
||||
|
||||
Reference in New Issue
Block a user