(t *testing.T)
| 454 | } |
| 455 | |
| 456 | func TestMigrateWithQuotedIndex(t *testing.T) { |
| 457 | if DB.Dialector.Name() != "mysql" { |
| 458 | t.Skip() |
| 459 | } |
| 460 | |
| 461 | type QuotedIndexStruct struct { |
| 462 | gorm.Model |
| 463 | Name string `gorm:"size:255;index:AS"` // AS is one of MySQL reserved words |
| 464 | } |
| 465 | |
| 466 | if err := DB.Migrator().DropTable(&QuotedIndexStruct{}); err != nil { |
| 467 | t.Fatalf("Failed to drop table, got error %v", err) |
| 468 | } |
| 469 | |
| 470 | if err := DB.AutoMigrate(&QuotedIndexStruct{}); err != nil { |
| 471 | t.Fatalf("Failed to auto migrate, but got error %v", err) |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | func TestMigrateIndexes(t *testing.T) { |
| 476 | type IndexStruct struct { |
nothing calls this directly
no test coverage detected