@@ -155,7 +155,7 @@ func (m Migrator) AlterColumn(value interface{}, field string) error {
155
155
156
156
return m .DB .Exec (
157
157
"ALTER TABLE ? MODIFY COLUMN ? ?" ,
158
- clause. Table { Name : stmt . Table } , clause.Column {Name : field .DBName }, fullDataType ,
158
+ m . CurrentTable ( stmt ) , clause.Column {Name : field .DBName }, fullDataType ,
159
159
).Error
160
160
}
161
161
}
@@ -215,7 +215,7 @@ func (m Migrator) RenameColumn(value interface{}, oldName, newName string) error
215
215
if field != nil {
216
216
return m .DB .Exec (
217
217
"ALTER TABLE ? CHANGE ? ? ?" ,
218
- clause. Table { Name : stmt . Table } , clause.Column {Name : oldName },
218
+ m . CurrentTable ( stmt ) , clause.Column {Name : oldName },
219
219
clause.Column {Name : newName }, m .FullDataTypeOf (field ),
220
220
).Error
221
221
}
@@ -252,7 +252,7 @@ func (m Migrator) RenameIndex(value interface{}, oldName, newName string) error
252
252
return m .RunWithValue (value , func (stmt * gorm.Statement ) error {
253
253
return m .DB .Exec (
254
254
"ALTER TABLE ? RENAME INDEX ? TO ?" ,
255
- clause. Table { Name : stmt . Table } , clause.Column {Name : oldName }, clause.Column {Name : newName },
255
+ m . CurrentTable ( stmt ) , clause.Column {Name : oldName }, clause.Column {Name : newName },
256
256
).Error
257
257
})
258
258
}
@@ -267,7 +267,7 @@ func (m Migrator) RenameIndex(value interface{}, oldName, newName string) error
267
267
if idx := stmt .Schema .LookIndex (newName ); idx == nil {
268
268
if idx = stmt .Schema .LookIndex (oldName ); idx != nil {
269
269
opts := m .BuildIndexOptions (idx .Fields , stmt )
270
- values := []interface {}{clause.Column {Name : newName }, clause. Table { Name : stmt . Table } , opts }
270
+ values := []interface {}{clause.Column {Name : newName }, m . CurrentTable ( stmt ) , opts }
271
271
272
272
createIndexSQL := "CREATE "
273
273
if idx .Class != "" {
@@ -295,7 +295,7 @@ func (m Migrator) DropTable(values ...interface{}) error {
295
295
tx .Exec ("SET FOREIGN_KEY_CHECKS = 0;" )
296
296
for i := len (values ) - 1 ; i >= 0 ; i -- {
297
297
if err := m .RunWithValue (values [i ], func (stmt * gorm.Statement ) error {
298
- return tx .Exec ("DROP TABLE IF EXISTS ? CASCADE" , clause. Table { Name : stmt . Table } ).Error
298
+ return tx .Exec ("DROP TABLE IF EXISTS ? CASCADE" , m . CurrentTable ( stmt ) ).Error
299
299
}); err != nil {
300
300
return err
301
301
}
0 commit comments