func DropTables(db *gorm.DB) error { err := db.DropTable(UserFileInfo{}).Error if err != nil { return err } return db.DropTable(UserFile{}).Error }
func InitTable(DB *gorm.DB) *gorm.DB { DB.DropTable(&User{}) DB.AutoMigrate(&User{}) account.InitTable(DB) createTestUser(DB) return DB }
func seedDb(db *gorm.DB) { db.DropTable(&User{}) db.CreateTable(&User{}) user1 := User{Name: "user1", Password: "******"} user2 := User{Name: "user2", Password: "******"} admin := User{Name: "admin", Password: "******", Admin: true} db.Create(&user1) db.Create(&user2) db.Create(&admin) db.DropTable(&PrivateWidget{}) db.CreateTable(&PrivateWidget{}) db.Create(&PrivateWidget{Name: "User 1's Widget", UserID: user1.ID}) db.Create(&PrivateWidget{Name: "User 2's Widget", UserID: user2.ID}) }
func MigrationsUp(db *gorm.DB) { log.Println("Starting migrations") // Drop table db.DropTable(&User{}, &Phone{}, &Email{}, &Language{}) // Create table //db.CreateTable(&User{}) db.Set("gorm:table_options", "ENGINE=InnoDB").CreateTable(&User{}, &Phone{}, &Email{}, &Language{}) // ModifyColumn //db.Model(&User{}).ModifyColumn("description", "text") // DropColumn //db.Model(&User{}).DropColumn("description") // Automating Migration db.AutoMigrate(&User{}, &Phone{}, &Email{}, &Language{}) }
func DropTables(db *gorm.DB) error { var err error err = db.DropTable(Visitor{}).Error if err != nil { return err } err = db.DropTable(UserBasic{}).Error if err != nil { return err } err = db.DropTable(UserAddress{}).Error if err != nil { return err } err = db.DropTable(UserPhone{}).Error if err != nil { return err } err = db.DropTable(UserProfileElement{}).Error if err != nil { return err } return nil }
func DropTables(db *gorm.DB) error { var err error err = db.DropTable(VisitorPageRequest{}).Error if err != nil { return err } err = db.DropTable(VisitorMouseEvents{}).Error if err != nil { return err } err = db.DropTable(VisitorKeyboardEvents{}).Error if err != nil { return err } err = db.DropTable(UserPageRequest{}).Error if err != nil { return err } err = db.DropTable(UserMouseEvents{}).Error if err != nil { return err } err = db.DropTable(UserKeyboardEvents{}).Error if err != nil { return err } return nil }
func DropTables(db *gorm.DB) error { return db.DropTable(MaillistUser{}).Error }
func testShutdown(t *testing.T, db *gorm.DB) { err := db.DropTable(&Test{}).Error assert.Equal(t, nil, err, "error while droped table in DB") }
func DropTables(db *gorm.DB) error { return db.DropTable(UserAuth{}).Error }
func InitTable(DB *gorm.DB) *gorm.DB { DB.DropTable(&Account{}) DB.AutoMigrate(&Account{}) return DB }