- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 21 for DropTable (0.09 sec)
-
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/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/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) -
tests/scanner_valuer_test.go
"fmt" "reflect" "regexp" "strconv" "testing" "time" "gorm.io/gorm" "gorm.io/gorm/clause" . "gorm.io/gorm/utils/tests" ) func TestScannerValuer(t *testing.T) { DB.Migrator().DropTable(&ScannerValuerStruct{}) if err := DB.Migrator().AutoMigrate(&ScannerValuerStruct{}); err != nil { t.Fatalf("no error should happen when migrate scanner, valuer struct, got error %v", err) } data := ScannerValuerStruct{
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 07 07:02:07 UTC 2023 - 10.6K bytes - Viewed (0) -
tests/preload_test.go
ID uint Preloads []*Preload Join Join ValueID uint } Value struct { ID uint Name string Nested Nested } ) DB.Migrator().DropTable(&Preload{}, &Join{}, &Nested{}, &Value{}) DB.Migrator().AutoMigrate(&Preload{}, &Join{}, &Nested{}, &Value{}) value1 := Value{ Name: "value", Nested: Nested{ Preloads: []*Preload{
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:00:47 UTC 2024 - 15.9K bytes - Viewed (0) -
tests/non_std_test.go
Age *time.Time unexported string // unexported value CreatedAt time.Time UpdatedAt time.Time } func TestNonStdPrimaryKeyAndDefaultValues(t *testing.T) { DB.Migrator().DropTable(&Animal{}) if err := DB.AutoMigrate(&Animal{}); err != nil { t.Fatalf("no error should happen when migrate but got %v", err) } animal := Animal{Name: "Ferdinand"} DB.Save(&animal)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed May 08 04:07:58 UTC 2024 - 1.9K bytes - Viewed (0)