(t *testing.T)
| 122 | } |
| 123 | |
| 124 | func TestAutoMigrateSelfReferential(t *testing.T) { |
| 125 | type MigratePerson struct { |
| 126 | ID uint |
| 127 | Name string |
| 128 | ManagerID *uint |
| 129 | Manager *MigratePerson |
| 130 | } |
| 131 | |
| 132 | DB.Migrator().DropTable(&MigratePerson{}) |
| 133 | |
| 134 | if err := DB.AutoMigrate(&MigratePerson{}); err != nil { |
| 135 | t.Fatalf("Failed to auto migrate, but got error %v", err) |
| 136 | } |
| 137 | |
| 138 | if !DB.Migrator().HasConstraint("migrate_people", "fk_migrate_people_manager") { |
| 139 | t.Fatalf("Failed to find has one constraint between people and managers") |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | func TestAutoMigrateNullable(t *testing.T) { |
| 144 | type MigrateNullableColumn struct { |
nothing calls this directly
no test coverage detected