mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #34050 -- Replaced invalid chars in migration names with '_'.
Thanks to Bishal Gautam for the report and initial implementation.
Regression in fa58450a9a.
Co-Authored-By: Bishal Gautam <bisalgt@gmail.com>
This commit is contained in:
committed by
Mariusz Felisiak
parent
d938b3b257
commit
cd03e8e2d6
@@ -5314,6 +5314,20 @@ class MigrationSuggestNameTests(SimpleTestCase):
|
||||
migration = Migration("some_migration", "test_app")
|
||||
self.assertIs(migration.suggest_name().startswith("auto_"), True)
|
||||
|
||||
def test_operation_with_invalid_chars_in_suggested_name(self):
|
||||
class Migration(migrations.Migration):
|
||||
operations = [
|
||||
migrations.AddConstraint(
|
||||
"Person",
|
||||
models.UniqueConstraint(
|
||||
fields=["name"], name="person.name-*~unique!"
|
||||
),
|
||||
),
|
||||
]
|
||||
|
||||
migration = Migration("some_migration", "test_app")
|
||||
self.assertEqual(migration.suggest_name(), "person_person_name_unique_")
|
||||
|
||||
def test_none_name(self):
|
||||
class Migration(migrations.Migration):
|
||||
operations = [migrations.RunSQL("SELECT 1 FROM person;")]
|
||||
|
||||
Reference in New Issue
Block a user