mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #28363 -- Allowed naming the migration generated by squashmigrations.
This commit is contained in:
parent
5ccbcc5bf6
commit
5bb9b9a388
5 changed files with 49 additions and 3 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue