- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 15 for Migrator (0.09 sec)
-
migrator/migrator.go
// - "123" // - "abc456" // -"%$#@789" var regFullDataType = regexp.MustCompile(`\D*(\d+)\D?`) // TODO:? Create const vars for raw sql queries ? var _ gorm.Migrator = (*Migrator)(nil) // Migrator m struct type Migrator struct { Config } // Config schema config type Config struct { CreateIndexAfterCreateTable bool DB *gorm.DB gorm.Dialector }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Apr 26 07:15:49 UTC 2024 - 29K bytes - Viewed (0) -
tests/migrate_test.go
gorm.Model Name string } if err := DB.Migrator().RenameTable(&TableStruct{}, &NewTableStruct{}); err != nil { t.Fatalf("Failed to rename table, got error %v", err) } if !DB.Migrator().HasTable("new_table_structs") { t.Fatal("should found renamed table") } DB.Migrator().DropTable("new_table_structs") if DB.Migrator().HasTable(&NewTableStruct{}) {
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/embedded_struct_test.go
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) } for _, name := range []string{"author_id", "author_name", "author_email"} { if !DB.Migrator().HasColumn(&EngadgetPost{}, name) { t.Errorf("should has prefixed column %v", name)
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/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/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/preload_test.go
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{ {Value: "p1"}, {Value: "p2"},
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) -
tests/default_value_test.go
Name3 string `gorm:"size:233;notNull;default:''"` Age int `gorm:"default:18"` Created time.Time `gorm:"default:2000-01-02"` Enabled bool `gorm:"default:true"` } DB.Migrator().DropTable(&Harumph{}) if err := DB.AutoMigrate(&Harumph{}); err != nil { t.Fatalf("Failed to migrate with default value, got error: %v", err) } harumph := Harumph{Email: "******@****.***"}
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Apr 08 03:29:55 UTC 2024 - 2.3K 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) }
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/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 assert.NotPanics(t, func() {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 17 03:58:13 UTC 2024 - 15K bytes - Viewed (0)