- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 11 for DropTable (0.09 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/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/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/multi_primary_keys_test.go
stmt.Parse(&Blog{}) stmt.Schema.LookUpField("ID").Unique = true stmt.Parse(&Tag{}) stmt.Schema.LookUpField("ID").Unique = true // postgers only allow unique constraint matching given keys } DB.Migrator().DropTable(&Blog{}, &Tag{}, "blog_tags", "locale_blog_tags", "shared_blog_tags") if err := DB.AutoMigrate(&Blog{}, &Tag{}); err != nil { t.Fatalf("Failed to auto migrate, got error: %v", err) } blog := Blog{ Locale: "ZH",
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jan 06 07:02:53 UTC 2022 - 12.8K 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/create_test.go
} for _, pet := range pets { CheckPet(t, *pet, *pet) } }) } func TestCreateEmptyStruct(t *testing.T) { type EmptyStruct struct { ID uint } DB.Migrator().DropTable(&EmptyStruct{}) if err := DB.AutoMigrate(&EmptyStruct{}); err != nil { t.Errorf("no error should happen when auto migrate, but got %v", err) } if err := DB.Create(&EmptyStruct{}).Error; err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 19 03:50:28 UTC 2024 - 26.4K bytes - Viewed (0) -
tests/update_test.go
} } func TestUpdatesTableWithIgnoredValues(t *testing.T) { type ElementWithIgnoredField struct { Id int64 Value string IgnoredField int64 `gorm:"-"` } DB.Migrator().DropTable(&ElementWithIgnoredField{}) DB.AutoMigrate(&ElementWithIgnoredField{}) elem := ElementWithIgnoredField{Value: "foo", IgnoredField: 10} DB.Save(&elem) DB.Model(&ElementWithIgnoredField{}).
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Dec 04 03:50:58 UTC 2023 - 30.3K bytes - Viewed (0) -
tests/joins_test.go
CompanyID *uint Company Company } Building struct { gorm.Model Name string OwnerID *uint Owner Owner } ) DB.Migrator().DropTable(&Building{}, &Owner{}, &Furniture{}) DB.Migrator().AutoMigrate(&Building{}, &Owner{}, &Furniture{}) home := &Building{Name: "relation_empty"} DB.Create(home) var entries []Building
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 17 03:58:13 UTC 2024 - 15K bytes - Viewed (0) -
migrator/migrator.go
} err = tx.Exec(createTableSQL, values...).Error return err }); err != nil { return err } } return nil } // DropTable drop table for values func (m Migrator) DropTable(values ...interface{}) error { values = m.ReorderModels(values, false) for i := len(values) - 1; i >= 0; i-- { tx := m.DB.Session(&gorm.Session{})
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Apr 26 07:15:49 UTC 2024 - 29K bytes - Viewed (0)