- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 29 for DropTable (0.11 sec)
-
tests/preload_suits_test.go
LanguageCode string `gorm:"primary_key"` Value string Level1s []Level1 `gorm:"many2many:levels;"` } ) DB.Migrator().DropTable(&Level2{}, &Level1{}) DB.Migrator().DropTable("levels") if err := DB.AutoMigrate(&Level2{}, &Level1{}); err != nil { t.Error(err) } want := Level2{Value: "Bob", LanguageCode: "ru", Level1s: []Level1{
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Mar 18 05:38:46 UTC 2022 - 30.3K bytes - Viewed (0) -
tests/migrate_test.go
rand.Seed(time.Now().UnixNano()) rand.Shuffle(len(allModels), func(i, j int) { allModels[i], allModels[j] = allModels[j], allModels[i] }) DB.Migrator().DropTable("user_speaks", "user_friends", "ccc") if err := DB.Migrator().DropTable(allModels...); err != nil { t.Fatalf("Failed to drop table, got error %v", err) } if err := DB.AutoMigrate(allModels...); err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Mar 18 11:24:16 UTC 2024 - 56.2K bytes - Viewed (0) -
tests/postgres_test.go
} if err := DB.Exec("CREATE EXTENSION IF NOT EXISTS pgcrypto;").Error; err != nil { t.Errorf("Failed to create extension pgcrypto, got error %v", err) } DB.Migrator().DropTable(&Yasuo{}) if err := DB.AutoMigrate(&Yasuo{}); err != nil { t.Fatalf("Failed to migrate for uuid default value, got error: %v", err) } yasuo := Yasuo{Name: "jinzhu"}
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sat Oct 08 09:16:32 UTC 2022 - 6.4K bytes - Viewed (0) -
tests/hooks_test.go
} func TestRunCallbacks(t *testing.T) { DB.Migrator().DropTable(&Product{}) DB.AutoMigrate(&Product{}) p := Product{Code: "unique_code", Price: 100} DB.Save(&p) if !reflect.DeepEqual(p.GetCallTimes(), []int64{1, 1, 0, 1, 1, 0, 0, 0, 0}) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 17 03:59:06 UTC 2024 - 16.7K bytes - Viewed (0) -
tests/associations_test.go
type Profile struct { gorm.Model Number string MemberID uint `gorm:"not null"` } type Member struct { gorm.Model Profiles []Profile } DB.Migrator().DropTable(&Member{}, &Profile{}) if err := DB.AutoMigrate(&Member{}, &Profile{}); err != nil { t.Fatalf("Failed to migrate, got error: %v", err) } member := &Member{ Profiles: []Profile{{ Number: "1",
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Feb 08 08:29:09 UTC 2023 - 10.9K bytes - Viewed (0) -
tests/embedded_struct_test.go
Upvotes int32 } type EngadgetPost struct { BasePost BasePost `gorm:"Embedded"` Author *Author `gorm:"Embedded;EmbeddedPrefix:author_"` // Embedded struct ImageUrl string } DB.Migrator().DropTable(&HNPost{}, &EngadgetPost{}) if err := DB.Migrator().AutoMigrate(&HNPost{}, &EngadgetPost{}); err != nil { t.Fatalf("failed to auto migrate, got error: %v", err) }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed May 08 04:07:58 UTC 2024 - 7.3K bytes - Viewed (0) -
tests/error_translator_test.go
} dialectors := map[string]bool{"sqlite": true, "postgres": true, "mysql": true, "sqlserver": true} if supported, found := dialectors[db.Dialector.Name()]; !(found && supported) { return } DB.Migrator().DropTable(&City{}) if err = db.AutoMigrate(&City{}); err != nil { t.Fatalf("failed to migrate cities table, got error: %v", err) } err = db.Create(&City{Name: "Kabul"}).Error if err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jul 12 13:21:22 UTC 2023 - 3.1K bytes - Viewed (0) -
tests/customize_field_test.go
type CustomizeColumn struct { ID int64 `gorm:"column:mapped_id; primary_key:yes"` Name string `gorm:"column:mapped_name"` Date *time.Time `gorm:"column:mapped_time"` } DB.Migrator().DropTable(&CustomizeColumn{}) DB.AutoMigrate(&CustomizeColumn{}) expected := "foo" now := time.Now() cc := CustomizeColumn{ID: 666, Name: expected, Date: &now} if count := DB.Create(&cc).RowsAffected; count != 1 {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Sep 11 09:33:31 UTC 2020 - 6.9K bytes - Viewed (0) -
tests/serializer_test.go
return fmt.Sprintf("%s%s", c.prefix, fieldValue), nil } func TestSerializer(t *testing.T) { schema.RegisterSerializer("custom", NewCustomSerializer("hello")) DB.Migrator().DropTable(adaptorSerializerModel(&SerializerStruct{})) if err := DB.Migrator().AutoMigrate(adaptorSerializerModel(&SerializerStruct{})); err != nil { t.Fatalf("no error should happen when migrate scanner, valuer struct, got error %v", err)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Apr 21 14:09:38 UTC 2023 - 7.6K bytes - Viewed (0) -
tests/tests_test.go
rand.Seed(time.Now().UnixNano()) rand.Shuffle(len(allModels), func(i, j int) { allModels[i], allModels[j] = allModels[j], allModels[i] }) DB.Migrator().DropTable("user_friends", "user_speaks") if err = DB.Migrator().DropTable(allModels...); err != nil { log.Printf("Failed to drop table, got error %v\n", err) os.Exit(1) } if err = DB.AutoMigrate(allModels...); err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Sep 30 03:21:19 UTC 2024 - 3.3K bytes - Viewed (0)