1
0
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:
andrewdotn
2021-11-02 00:13:42 -06:00
committed by GitHub
parent c3e0dfe4cc
commit 9e6d631697
2 changed files with 15 additions and 0 deletions

View File

@@ -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):
"""