Skip re-initializing tables when running in prod to make server startup faster

This commit is contained in:
David Dworken 2023-09-15 17:51:14 -07:00
parent 29108dd15f
commit b733878878
No known key found for this signature in database

View File

@ -89,10 +89,12 @@ func OpenDB() (*database.DB, error) {
}
}
fmt.Println("AutoMigrating DB tables")
if !isProductionEnvironment() {
err := db.AddDatabaseTables()
if err != nil {
return nil, fmt.Errorf("failed to create underlying DB tables: %w", err)
}
}
return db, nil
}