Update migrate_test.go

This commit is contained in:
Jinzhu 2021-11-13 13:57:36 +08:00 committed by GitHub
parent 3628a21ece
commit 2858606bc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,25 +70,6 @@ func TestMigrate(t *testing.T) {
}
}
func TestAutoMigrateSelfReferential(t *testing.T) {
type MigratePerson struct {
ID uint
Name string
ManagerID *uint
Manager *MigratePerson
}
DB.Migrator().DropTable(&MigratePerson{})
if err := DB.AutoMigrate(&MigratePerson{}); err != nil {
t.Fatalf("Failed to auto migrate, but got error %v", err)
}
if !DB.Migrator().HasConstraint("migrate_people", "fk_migrate_people_manager") {
t.Fatalf("Failed to find has one constraint between people and managers")
}
}
func TestSmartMigrateColumn(t *testing.T) {
fullSupported := map[string]bool{"mysql": true, "postgres": true}[DB.Dialector.Name()]