Initialize stmt.Schema in RunWithValue when value is a table name string

This commit is contained in:
Annalise Tarhan 2023-04-27 15:21:14 +02:00
parent aeb298635b
commit 2e770fbd25

View File

@ -55,6 +55,9 @@ func (m Migrator) RunWithValue(value interface{}, fc func(*gorm.Statement) error
if table, ok := value.(string); ok { if table, ok := value.(string); ok {
stmt.Table = table stmt.Table = table
if err := stmt.Parse(value); err != nil {
return err
}
} else if err := stmt.ParseWithSpecialTableName(value, stmt.Table); err != nil { } else if err := stmt.ParseWithSpecialTableName(value, stmt.Table); err != nil {
return err return err
} }