(self)
| 5085 | |
| 5086 | @skipUnlessDBFeature("supports_comments", "supports_foreign_keys") |
| 5087 | def test_alter_db_comment_foreign_key(self): |
| 5088 | with connection.schema_editor() as editor: |
| 5089 | editor.create_model(Author) |
| 5090 | editor.create_model(Book) |
| 5091 | |
| 5092 | comment = "FK custom comment" |
| 5093 | old_field = Book._meta.get_field("author") |
| 5094 | new_field = ForeignKey(Author, CASCADE, db_comment=comment) |
| 5095 | new_field.set_attributes_from_name("author") |
| 5096 | with connection.schema_editor() as editor: |
| 5097 | editor.alter_field(Book, old_field, new_field, strict=True) |
| 5098 | self.assertEqual( |
| 5099 | self.get_column_comment(Book._meta.db_table, "author_id"), |
| 5100 | comment, |
| 5101 | ) |
| 5102 | |
| 5103 | @skipUnlessDBFeature("supports_comments") |
| 5104 | def test_alter_field_type_preserve_comment(self): |
nothing calls this directly
no test coverage detected