refactor: consolidate applyMigrations into single exported function
All checks were successful
check / check (push) Successful in 1m8s
All checks were successful
check / check (push) Successful in 1m8s
Remove the unexported applyMigrations() and the runMigrations() method. ApplyMigrations() is now the single implementation, accepting context and an optional logger. connect() calls it directly. All callers updated to pass context.Background() and nil logger.
This commit is contained in:
@@ -94,7 +94,7 @@ func TestApplyMigrations(t *testing.T) {
|
||||
defer db.Close()
|
||||
|
||||
// Apply migrations should succeed.
|
||||
if err := ApplyMigrations(db); err != nil {
|
||||
if err := ApplyMigrations(context.Background(), db, nil); err != nil {
|
||||
t.Fatalf("ApplyMigrations failed: %v", err)
|
||||
}
|
||||
|
||||
@@ -131,11 +131,11 @@ func TestApplyMigrationsIdempotent(t *testing.T) {
|
||||
defer db.Close()
|
||||
|
||||
// Apply twice should succeed (idempotent).
|
||||
if err := ApplyMigrations(db); err != nil {
|
||||
if err := ApplyMigrations(context.Background(), db, nil); err != nil {
|
||||
t.Fatalf("first ApplyMigrations failed: %v", err)
|
||||
}
|
||||
|
||||
if err := ApplyMigrations(db); err != nil {
|
||||
if err := ApplyMigrations(context.Background(), db, nil); err != nil {
|
||||
t.Fatalf("second ApplyMigrations failed: %v", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user