Add table options

This commit is contained in:
Jinzhu 2020-06-14 19:13:16 +08:00
parent 56bdded0f8
commit 1fdc66710e
1 changed files with 5 additions and 0 deletions

View File

@ -203,6 +203,11 @@ func (m Migrator) CreateTable(values ...interface{}) error {
createTableSQL = strings.TrimSuffix(createTableSQL, ",") createTableSQL = strings.TrimSuffix(createTableSQL, ",")
createTableSQL += ")" createTableSQL += ")"
if tableOption, ok := m.DB.Get("gorm:table_options"); ok {
createTableSQL += fmt.Sprint(tableOption)
}
return tx.Exec(createTableSQL, values...).Error return tx.Exec(createTableSQL, values...).Error
}); err != nil { }); err != nil {
return err return err