aboutsummaryrefslogtreecommitdiffstats
path: root/internal/commands
diff options
context:
space:
mode:
Diffstat (limited to 'internal/commands')
-rw-r--r--internal/commands/down.go7
-rw-r--r--internal/commands/status.go7
-rw-r--r--internal/commands/up.go7
3 files changed, 6 insertions, 15 deletions
diff --git a/internal/commands/down.go b/internal/commands/down.go
index 116d9ce..0ba3abb 100644
--- a/internal/commands/down.go
+++ b/internal/commands/down.go
@@ -54,15 +54,12 @@ func (cmd *DownCmd) Execute(
return subcommands.ExitFailure
}
- db, err := storage.DBConnect(
- cfg.Connection.Driver,
- storage.DBConnectionString(&cfg.Connection),
- )
+ db, err := storage.DBConnect(cfg.Connection)
if err != nil {
consoleOutputter.Error(fmt.Errorf("unable to connect to database: %w", err))
return subcommands.ExitFailure
}
- defer db.Close()
+ defer db.Session.Close()
migrationDBRepo, err := repositories.NewMigrationDBRepo(db)
if err != nil {
diff --git a/internal/commands/status.go b/internal/commands/status.go
index 76f7427..d44a132 100644
--- a/internal/commands/status.go
+++ b/internal/commands/status.go
@@ -44,15 +44,12 @@ func (m *StatusCmd) Execute(
return subcommands.ExitFailure
}
- db, err := storage.DBConnect(
- cfg.Connection.Driver,
- storage.DBConnectionString(&cfg.Connection),
- )
+ db, err := storage.DBConnect(cfg.Connection)
if err != nil {
consoleOutputter.Error(fmt.Errorf("unable to connect to database: %w", err))
return subcommands.ExitFailure
}
- defer db.Close()
+ defer db.Session.Close()
migrationDBRepo, err := repositories.NewMigrationDBRepo(db)
if err != nil {
diff --git a/internal/commands/up.go b/internal/commands/up.go
index 330864f..a203d2e 100644
--- a/internal/commands/up.go
+++ b/internal/commands/up.go
@@ -54,15 +54,12 @@ func (cmd *UpCmd) Execute(
return subcommands.ExitFailure
}
- db, err := storage.DBConnect(
- cfg.Connection.Driver,
- storage.DBConnectionString(&cfg.Connection),
- )
+ db, err := storage.DBConnect(cfg.Connection)
if err != nil {
consoleOutputter.Error(fmt.Errorf("unable to connect to database: %w", err))
return subcommands.ExitFailure
}
- defer db.Close()
+ defer db.Session.Close()
migrationDBRepo, err := repositories.NewMigrationDBRepo(db)
if err != nil {