func AutoMigrate(values ...interface{}) { for _, value := range values { db.DB.AutoMigrate(value) if publish.IsPublishableModel(value) { db.Publish.AutoMigrate(value) } } }
func TruncateTables(tables ...interface{}) { for _, table := range tables { if err := db.DB.DropTableIfExists(table).Error; err != nil { panic(err) } if err := db.Publish.DraftDB().DropTableIfExists(table).Error; err != nil { panic(err) } db.DB.AutoMigrate(table) if publish.IsPublishableModel(table) { db.Publish.AutoMigrate(table) } } }