| 53 | } |
| 54 | |
| 55 | func TestMigrate_createsSchemaTable(t *testing.T) { |
| 56 | db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{}) |
| 57 | if err != nil { |
| 58 | t.Fatalf("failed to open database: %v", err) |
| 59 | } |
| 60 | |
| 61 | migrationsFs := fstest.MapFS{} |
| 62 | migrate(db, migrationsFs) |
| 63 | |
| 64 | // Verify schema_migrations table exists |
| 65 | var count int64 |
| 66 | if err := db.Raw("SELECT COUNT(*) FROM schema_migrations").Scan(&count).Error; err != nil { |
| 67 | t.Fatalf("schema_migrations table not found: %v", err) |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | func TestMigrate_idempotency(t *testing.T) { |
| 72 | db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{}) |