Fixed #31468 -- Allowed specifying migration filename in Operation.

This adds also suggested filename for many built-in operations.
This commit is contained in:
Adam Johnson 2019-11-23 11:08:45 +00:00 committed by Mariusz Felisiak
parent 5bd585a82d
commit fa58450a9a
10 changed files with 149 additions and 13 deletions

View file

@ -2495,6 +2495,11 @@ class AutodetectorSuggestNameTests(SimpleTestCase):
]
self.assertEqual(MigrationAutodetector.suggest_name(ops), 'animal_person')
def test_none_name(self):
ops = [migrations.RunSQL('SELECT 1 FROM person;')]
suggest_name = MigrationAutodetector.suggest_name(ops)
self.assertIs(suggest_name.startswith('auto_'), True)
def test_auto(self):
suggest_name = MigrationAutodetector.suggest_name([])
self.assertIs(suggest_name.startswith('auto_'), True)