mirror of
https://github.com/ddworken/hishtory.git
synced 2025-08-18 18:58:54 +02:00
* Add test coverage to prevent issues like #241 in the future * Add debugging * Fix location of HISHTORY_COMPOSE_TEST var * Enable tmate for failures * update * Re-comment tmate
This commit is contained in:
@@ -97,7 +97,19 @@ func OpenDB() (*database.DB, error) {
|
||||
}
|
||||
err = db.CreateIndices()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("failed to create indices: %w", err)
|
||||
}
|
||||
}
|
||||
if os.Getenv("HISHTORY_COMPOSE_TEST") != "" {
|
||||
// Run an extra round of migrations to test the migration code path to prevent issues like #241
|
||||
fmt.Println("AutoMigrating DB tables a second time for test coverage")
|
||||
err := db.AddDatabaseTables()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create underlying DB tables: %w", err)
|
||||
}
|
||||
err = db.CreateIndices()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create indices: %w", err)
|
||||
}
|
||||
}
|
||||
return db, nil
|
||||
|
Reference in New Issue
Block a user