SQLStore: Add deprecation comments for breaking migrations (#49740)
* Migrator: Extend support to rename columns * SQLStore: Add deprecation comments for breaking migrations
This commit is contained in:
@@ -118,18 +118,12 @@ func (db *MySQLDialect) ColumnCheckSQL(tableName, columnName string) (string, []
|
||||
return sql, args
|
||||
}
|
||||
|
||||
func (db *MySQLDialect) RenameColumn(table Table, oldName, newName string) string {
|
||||
var colType string
|
||||
for _, col := range table.Columns {
|
||||
if col.Name == oldName {
|
||||
colType = db.SQLType(col)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func (db *MySQLDialect) RenameColumn(table Table, column *Column, newName string) string {
|
||||
quote := db.dialect.Quote
|
||||
|
||||
return fmt.Sprintf("ALTER TABLE %s CHANGE %s %s %s", quote(table.Name), quote(oldName), quote(newName), colType)
|
||||
return fmt.Sprintf(
|
||||
"ALTER TABLE %s CHANGE %s %s %s",
|
||||
quote(table.Name), quote(column.Name), quote(newName), db.SQLType(column),
|
||||
)
|
||||
}
|
||||
|
||||
func (db *MySQLDialect) CleanDB() error {
|
||||
|
||||
Reference in New Issue
Block a user