comment out table drops

This commit is contained in:
Ravi Prasad
2025-07-08 23:15:32 -05:00
parent fe1379e54e
commit bec96a1578
3 changed files with 36 additions and 36 deletions
+12 -12
View File
@@ -33,18 +33,18 @@ func InitDB(shouldMigrate bool) *gorm.DB {
// --- ADD THIS BLOCK TO DROP STALE TABLES ---
// Drop tables in reverse order of dependency (children first).
// This ensures a clean migration every time the import process runs.
log.Println("⚠️ Dropping existing game-related tables for a clean migration...")
if err := db.Migrator().DropTable(
&models.LineScore{},
&models.PlayerGameBasicStat{},
&models.PlayerGameAdvStat{},
&models.TeamGameBasicStat{},
&models.TeamGameAdvStat{},
&models.Game{}, // Drop parent table last
); err != nil {
log.Fatalf("failed to drop tables: %v", err)
}
log.Println("✅ Tables dropped successfully.")
// log.Println("⚠️ Dropping existing game-related tables for a clean migration...")
// if err := db.Migrator().DropTable(
// &models.LineScore{},
// &models.PlayerGameBasicStat{},
// &models.PlayerGameAdvStat{},
// &models.TeamGameBasicStat{},
// &models.TeamGameAdvStat{},
// &models.Game{}, // Drop parent table last
// ); err != nil {
// log.Fatalf("failed to drop tables: %v", err)
// }
// log.Println("✅ Tables dropped successfully.")
// --- END OF ADDED BLOCK ---