use dbx.SQLOFunc instead of sql.DB

This commit is contained in:
Elijah Duffy
2025-06-05 14:22:15 -07:00
parent 4d251ffbcf
commit f35bbfcbad
2 changed files with 20 additions and 21 deletions

View File

@@ -2,7 +2,6 @@ package migrate
import (
"context"
"database/sql"
"io/fs"
"log/slog"
"time"
@@ -14,8 +13,8 @@ import (
// MigrationsOpts define the options for the migrations module.
type MigrationOpts struct {
// SQLO is the SQL database handle used for migrations. REQUIRED.
SQLO *sql.DB
// SQLO is the SQL database handle getter used for migrations. REQUIRED.
SQLO dbx.SQLOFunc
// Dialect is the database dialect used for migrations (e.g., "mysql", "postgres").
// REQUIRED. Must match the dialect used in dbx.
@@ -138,7 +137,7 @@ func setupMigrations(_ *app.Module) error {
}
// Initialize the goose migration provider
Migration, err = goose.NewProvider(migrationsConfig.Dialect, migrationsConfig.SQLO, migrationsConfig.FS)
Migration, err = goose.NewProvider(migrationsConfig.Dialect, migrationsConfig.SQLO(), migrationsConfig.FS)
if err != nil {
slog.Error("Couldn't initialize goose migration provider", "err", err)
return err