1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

[5.0.x] Fixed #35006 -- Fixed migrations crash when altering Meta.db_table_comment on SQLite.

Thanks Юрий for the report.

Regression in 78f163a4fb.
Backport of 37fc832a54 from main
This commit is contained in:
Mariusz Felisiak
2023-11-30 10:10:27 +01:00
parent a4a0f66570
commit 7f1dc67f53
4 changed files with 30 additions and 7 deletions

View File

@@ -4870,6 +4870,23 @@ class SchemaTests(TransactionTestCase):
[None, ""],
)
@isolate_apps("schema")
@skipIfDBFeature("supports_comments")
def test_db_comment_table_unsupported(self):
class ModelWithDbTableComment(Model):
class Meta:
app_label = "schema"
db_table_comment = "Custom table comment"
# Table comments are ignored on databases that don't support them.
with connection.schema_editor() as editor, self.assertNumQueries(1):
editor.create_model(ModelWithDbTableComment)
self.isolated_local_models = [ModelWithDbTableComment]
with connection.schema_editor() as editor, self.assertNumQueries(0):
editor.alter_db_table_comment(
ModelWithDbTableComment, "Custom table comment", "New table comment"
)
@isolate_apps("schema")
@skipUnlessDBFeature("supports_comments", "supports_foreign_keys")
def test_db_comments_from_abstract_model(self):