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:
@@ -36,8 +36,12 @@ type Dialect interface {
|
||||
DropTable(tableName string) string
|
||||
DropIndexSQL(tableName string, index *Index) string
|
||||
|
||||
// RenameTable is deprecated, its use cause breaking changes
|
||||
// so, it should no longer be used. Kept for legacy reasons.
|
||||
RenameTable(oldName string, newName string) string
|
||||
RenameColumn(table Table, oldName, newName string) string
|
||||
// RenameColumn is deprecated, its use cause breaking changes
|
||||
// so, it should no longer be used. Kept for legacy reasons.
|
||||
RenameColumn(table Table, column *Column, newName string) string
|
||||
|
||||
UpdateTableSQL(tableName string, columns []*Column) string
|
||||
|
||||
@@ -211,9 +215,12 @@ func (b *BaseDialect) RenameTable(oldName string, newName string) string {
|
||||
return fmt.Sprintf("ALTER TABLE %s RENAME TO %s", quote(oldName), quote(newName))
|
||||
}
|
||||
|
||||
func (b *BaseDialect) RenameColumn(table Table, oldName, newName string) string {
|
||||
func (b *BaseDialect) RenameColumn(table Table, column *Column, newName string) string {
|
||||
quote := b.dialect.Quote
|
||||
return fmt.Sprintf("ALTER TABLE %s RENAME COLUMN %s TO %s", quote(table.Name), quote(oldName), quote(newName))
|
||||
return fmt.Sprintf(
|
||||
"ALTER TABLE %s RENAME COLUMN %s TO %s",
|
||||
quote(table.Name), quote(column.Name), quote(newName),
|
||||
)
|
||||
}
|
||||
|
||||
func (b *BaseDialect) ColumnCheckSQL(tableName, columnName string) (string, []interface{}) {
|
||||
|
||||
Reference in New Issue
Block a user