@@ -197,8 +197,6 @@ def _alter_column_null_sql(self, model, old_field, new_field):
197197 if django_version >= (4 , 2 ):
198198 def _alter_column_type_sql (self , model , old_field , new_field , new_type , old_collation , new_collation ):
199199 new_type = self ._set_field_new_type_null_status (old_field , new_type )
200- # Check if existing
201- # Drop exisiting
202200 return super ()._alter_column_type_sql (model , old_field , new_field , new_type , old_collation , new_collation )
203201 else :
204202 def _alter_column_type_sql (self , model , old_field , new_field , new_type ):
@@ -965,17 +963,18 @@ def add_field(self, model, field):
965963 }
966964 self .execute (sql , params )
967965 # Add field comment, if required.
968- if (
969- field .db_comment
970- and self .connection .features .supports_comments
971- and not self .connection .features .supports_comments_inline
972- ):
973- field_type = db_params ["type" ]
974- self .execute (
975- * self ._alter_column_comment_sql (
976- model , field , field_type , field .db_comment
966+ if django_version >= (4 , 2 ):
967+ if (
968+ field .db_comment
969+ and self .connection .features .supports_comments
970+ and not self .connection .features .supports_comments_inline
971+ ):
972+ field_type = db_params ["type" ]
973+ self .execute (
974+ * self ._alter_column_comment_sql (
975+ model , field , field_type , field .db_comment
976+ )
977977 )
978- )
979978 # Add an index, if required
980979 self .deferred_sql .extend (self ._field_indexes_sql (model , field ))
981980 # Add any FK constraints later
0 commit comments