Fix bug 'table user, animal not found'
This commit is contained in:
parent
acd21ce2ab
commit
fb7768f316
@ -294,7 +294,9 @@ func runMigration() {
|
||||
|
||||
values := []interface{}{&Short{}, &ReallyLongThingThatReferencesShort{}, &ReallyLongTableNameToTestMySQLNameLengthLimit{}, &NotSoLongTableName{}, &Product{}, &Email{}, &Address{}, &CreditCard{}, &Company{}, &Role{}, &Language{}, &HNPost{}, &EngadgetPost{}, &Animal{}, &User{}, &JoinTable{}, &Post{}, &Category{}, &Comment{}, &Cat{}, &Dog{}, &Hamster{}, &Toy{}, &ElementWithIgnoredField{}, &Place{}}
|
||||
for _, value := range values {
|
||||
DB.DropTable(value)
|
||||
if DB.HasTable(value){
|
||||
DB.DropTable(value)
|
||||
}
|
||||
}
|
||||
if err := DB.AutoMigrate(values...).Error; err != nil {
|
||||
panic(fmt.Sprintf("No error should happen when create table, but got %+v", err))
|
||||
|
Loading…
x
Reference in New Issue
Block a user