summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorsaJaeHyukc <wogur981208@gmail.com>2025-02-22 18:47:03 +0900
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2025-02-22 18:14:37 +0100
commitf7017db92cee1536c014710f475a613792c1e4b5 (patch)
tree38265b34b477a6da2b423c718b65a8837b2df0bc /django/db
parent87c5de3b7f2316aa17353d74f54e6ff19013d049 (diff)
Fixed #35839 -- Fixed crash when adding GeneratedField with db_comment on MySQL.
Thanks Simon Charette for the test. Signed-off-by: saJaeHyukc <wogur981208@gmail.com>
Diffstat (limited to 'django/db')
-rw-r--r--django/db/backends/base/schema.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py
index 6303248127..91351e5c9e 100644
--- a/django/db/backends/base/schema.py
+++ b/django/db/backends/base/schema.py
@@ -313,8 +313,6 @@ class BaseDatabaseSchemaEditor:
yield column_db_type
if collation := field_db_params.get("collation"):
yield self._collate_sql(collation)
- if self.connection.features.supports_comments_inline and field.db_comment:
- yield self._comment_sql(field.db_comment)
# Work out nullability.
null = field.null
# Add database default.
@@ -373,6 +371,8 @@ class BaseDatabaseSchemaEditor:
and field.unique
):
yield self.connection.ops.tablespace_sql(tablespace, inline=True)
+ if self.connection.features.supports_comments_inline and field.db_comment:
+ yield self._comment_sql(field.db_comment)
def column_sql(self, model, field, include_default=False):
"""