summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-11-30 10:10:27 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-11-30 10:11:02 +0100
commit7f1dc67f53c0d7a79031852603b8c8445bca65ac (patch)
tree7f219246edc74c04c3cb27760d883cce0dfc1ae7 /tests
parenta4a0f665708b32b9e27d74d82a94715cbdca480b (diff)
[5.0.x] Fixed #35006 -- Fixed migrations crash when altering Meta.db_table_comment on SQLite.
Thanks Юрий for the report. Regression in 78f163a4fb3937aca2e71786fbdd51a0ef39629e. Backport of 37fc832a54ad37e75a898a2c8f9ab0820617c4af from main
Diffstat (limited to 'tests')
-rw-r--r--tests/schema/tests.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py
index 0738026a31..a37b49b31d 100644
--- a/tests/schema/tests.py
+++ b/tests/schema/tests.py
@@ -4871,6 +4871,23 @@ class SchemaTests(TransactionTestCase):
)
@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):
class AbstractModelWithDbComments(Model):