File tree Expand file tree Collapse file tree 3 files changed +378
-32
lines changed
tests/apps/migrations/auto/integration Expand file tree Collapse file tree 3 files changed +378
-32
lines changed Original file line number Diff line number Diff line change @@ -84,13 +84,13 @@ class RenameColumnMysql(AlterColumnStatement):
8484
8585 @property
8686 def ddl (self ) -> str :
87- if not isinstance (self .column , Column ):
87+ if isinstance (self .column , str ):
8888 raise ValueError ("MySQL requires a column instance for renaming." )
89- col_type = self .column .column_type
89+ column_type = self .column .column_type
9090 null_sql = "NULL" if self .column ._meta .null else "NOT NULL"
9191 return (
9292 f"CHANGE `{ self .column_name } ` `{ self .new_name } ` "
93- f"{ col_type } { null_sql } "
93+ f"{ column_type } { null_sql } "
9494 )
9595
9696
Original file line number Diff line number Diff line change @@ -82,9 +82,7 @@ def mysql_ddl(self) -> Sequence[str]:
8282 tablename = self .table ._meta .get_formatted_tablename ()
8383
8484 column_names_str = ", " .join ([f"`{ i } `" for i in self .column_names ])
85+ prefix = "CREATE INDEX"
8586 return [
86- (
87- f"{ self .prefix } { index_name } ON { tablename } "
88- f"({ column_names_str } )"
89- )
87+ f"{ prefix } { index_name } ON { tablename } " f"({ column_names_str } )"
9088 ]
You can’t perform that action at this time.
0 commit comments