- Sort Score
- Result 10 results
- Languages All
Results 21 - 29 of 29 for DropTable (0.07 sec)
-
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/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/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} DB.Save(&book)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Feb 01 06:40:55 UTC 2023 - 5.7K 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/delete_test.go
} } func TestDeleteWithTable(t *testing.T) { type UserWithDelete struct { gorm.Model Name string } DB.Table("deleted_users").Migrator().DropTable(UserWithDelete{}) DB.Table("deleted_users").AutoMigrate(UserWithDelete{}) user := UserWithDelete{Name: "delete1"} DB.Table("deleted_users").Create(&user) var result UserWithDelete
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Oct 10 07:03:34 UTC 2023 - 9.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
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) -
tests/associations_has_many_test.go
} type Item struct { gorm.Model Logo string `gorm:"not null;type:varchar(50)"` Contents []ItemContent `gorm:"foreignKey:ItemID"` } tx := DB.Session(&gorm.Session{}) tx.Migrator().DropTable(&ItemContent{}, &Item{}) tx.AutoMigrate(&ItemContent{}, &Item{}) item := Item{ Logo: "logo", Contents: []ItemContent{ {Name: "name", LanguageCode: "en"}, {Name: "ar name", LanguageCode: "ar"},
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 16K bytes - Viewed (0) -
tests/query_test.go
} } func TestCustomizedTypePrimaryKey(t *testing.T) { type ID uint type CustomizedTypePrimaryKey struct { ID ID Name string } DB.Migrator().DropTable(&CustomizedTypePrimaryKey{}) if err := DB.AutoMigrate(&CustomizedTypePrimaryKey{}); err != nil { t.Fatalf("failed to migrate, got error %v", err) } p1 := CustomizedTypePrimaryKey{Name: "p1"}
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 24 09:42:59 UTC 2024 - 50.4K bytes - Viewed (0)