mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-27 07:22:29 +02:00
Skip re-initializing tables when running in prod to make server startup faster
This commit is contained in:
parent
29108dd15f
commit
b733878878
@ -89,9 +89,11 @@ func OpenDB() (*database.DB, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Println("AutoMigrating DB tables")
|
fmt.Println("AutoMigrating DB tables")
|
||||||
err := db.AddDatabaseTables()
|
if !isProductionEnvironment() {
|
||||||
if err != nil {
|
err := db.AddDatabaseTables()
|
||||||
return nil, fmt.Errorf("failed to create underlying DB tables: %w", err)
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to create underlying DB tables: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return db, nil
|
return db, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user