diff options
Diffstat (limited to 'tests/schema/tests.py')
| -rw-r--r-- | tests/schema/tests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py index 9bb71de0be..ff8c284812 100644 --- a/tests/schema/tests.py +++ b/tests/schema/tests.py @@ -4728,6 +4728,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): |
