- Sort Score
- Result 10 results
- Languages All
Results 21 - 30 of 37 for Migrator (0.13 sec)
-
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/named_argument_test.go
"testing" "gorm.io/gorm" . "gorm.io/gorm/utils/tests" ) func TestNamedArg(t *testing.T) { type NamedUser struct { gorm.Model Name1 string Name2 string Name3 string } DB.Migrator().DropTable(&NamedUser{}) DB.AutoMigrate(&NamedUser{}) namedUser := NamedUser{Name1: "jinzhu1", Name2: "jinzhu2", Name3: "jinzhu3"} DB.Create(&namedUser) var result NamedUser
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Dec 21 11:50:00 UTC 2021 - 2.7K bytes - Viewed (0) -
tests/associations_belongs_to_test.go
} tx := DB.Session(&gorm.Session{}) tx.Config.DisableForeignKeyConstraintWhenMigrating = true AssertEqual(t, DB.Config.DisableForeignKeyConstraintWhenMigrating, false) tx.Migrator().DropTable(&BelongsToUser{}, &Org{}) tx.AutoMigrate(&BelongsToUser{}, &Org{}) user := &BelongsToUser{ Org: Org{ ID: "BelongsToUser_Org_1", }, } err := DB.Create(&user).Error
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Oct 30 09:15:49 UTC 2023 - 9.3K bytes - Viewed (0) -
migrator/column_type.go
package migrator import ( "database/sql" "reflect" ) // ColumnType column type implements ColumnType interface type ColumnType struct { SQLColumnType *sql.ColumnType NameValue sql.NullString DataTypeValue sql.NullString ColumnTypeValue sql.NullString PrimaryKeyValue sql.NullBool UniqueValue sql.NullBool AutoIncrementValue sql.NullBool LengthValue sql.NullInt64
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Mar 24 01:31:58 UTC 2022 - 3.3K bytes - Viewed (0) -
tests/joins_table_test.go
ID uint Name string } type PersonAddress struct { PersonID int AddressID int CreatedAt time.Time DeletedAt gorm.DeletedAt } func TestOverrideJoinTable(t *testing.T) { DB.Migrator().DropTable(&Person{}, &Address{}, &PersonAddress{}) if err := DB.SetupJoinTable(&Person{}, "Addresses", &PersonAddress{}); err != nil { t.Fatalf("Failed to setup join table for person, got error %v", err) }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Sep 10 13:46:18 UTC 2020 - 3.5K bytes - Viewed (0) -
tests/named_polymorphic_test.go
PreferredToy Toy `gorm:"polymorphic:Owner;polymorphicValue:hamster_preferred"` OtherToy Toy `gorm:"polymorphic:Owner;polymorphicValue:hamster_other"` } func TestNamedPolymorphic(t *testing.T) { DB.Migrator().DropTable(&Hamster{}) DB.AutoMigrate(&Hamster{}) hamster := Hamster{Name: "Mr. Hammond", PreferredToy: Toy{Name: "bike"}, OtherToy: Toy{Name: "treadmill"}} DB.Save(&hamster) hamster2 := Hamster{}
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jul 08 09:59:40 UTC 2020 - 4.2K 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) -
tests/soft_delete_test.go
func TestSoftDeleteZeroValue(t *testing.T) { type SoftDeleteBook struct { ID uint Name string Pages uint DeletedAt gorm.DeletedAt `gorm:"zeroValue:'1970-01-01 00:00:01'"` } DB.Migrator().DropTable(&SoftDeleteBook{}) if err := DB.AutoMigrate(&SoftDeleteBook{}); err != nil { t.Fatalf("failed to auto migrate soft delete table") } book := SoftDeleteBook{Name: "jinzhu", Pages: 10}
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Feb 01 06:40:55 UTC 2023 - 5.7K bytes - Viewed (0)