mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #33246 -- Made squashmigrations raise CommandError when squashed_name already exists.
This commit is contained in:
@@ -2082,6 +2082,15 @@ class SquashMigrationsTests(MigrationTestBase):
|
||||
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_exists(self):
|
||||
msg = 'Migration 0001_initial already exists. Use a different name.'
|
||||
with self.temporary_migration_module(module='migrations.test_migrations'):
|
||||
with self.assertRaisesMessage(CommandError, msg):
|
||||
call_command(
|
||||
'squashmigrations', 'migrations', '0001', '0002',
|
||||
squashed_name='initial', interactive=False, verbosity=0,
|
||||
)
|
||||
|
||||
|
||||
class AppLabelErrorTests(TestCase):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user