Skip to content

Commit

Permalink
fix(data): fix migration error message
Browse files Browse the repository at this point in the history
  • Loading branch information
GMKrieger committed Jul 1, 2024
1 parent a264859 commit b1abbba
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions internal/repository/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package repository
import (
"embed"
_ "embed"
"errors"
"log/slog"

"github.com/golang-migrate/migrate/v4"
Expand All @@ -24,13 +25,15 @@ func RunMigrations(postgres_endpoint string) {
"error", err)
}

migrate, err := migrate.NewWithSourceInstance("iofs", driver, postgres_endpoint)
migration, err := migrate.NewWithSourceInstance("iofs", driver, postgres_endpoint)
if err != nil {
slog.Error("Unable to setup migrations",
"error", err)
}
if err := migrate.Up(); err != nil {
slog.Error("Unable to run migrations",
"error", err)
if err := migration.Up(); err != nil {
if !errors.Is(err, migrate.ErrNoChange) {
slog.Error("Unable to run migrations",
"error", err)
}
}
}

0 comments on commit b1abbba

Please sign in to comment.