Skip to content

Commit

Permalink
fix(grpcfx): change zap to Logger interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ripls56 committed Oct 29, 2024
1 parent 6afce4d commit 09c9daa
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions apps/server/internal/pkg/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,26 @@ import (
"database/sql"
"github.com/pressly/goose/v3"
"github.com/taskemapp/server/apps/server/internal/config"
"github.com/taskemapp/server/apps/server/internal/pkg/logger"
"go.uber.org/zap"
)

func Invoke(c config.Config, log *zap.Logger) error {
func Invoke(c config.Config, log logger.Logger) error {
if err := goose.SetDialect("pgx"); err != nil {
log.Sugar().Error("Failed to set dialect: ", err)
log.Error("Failed to set dialect: ", zap.Error(err))
return err
}
db, err := sql.Open("pgx", c.PostgresUrl)
if err != nil {
log.Sugar().Error("Failed to open db conn: ", err)
log.Error("Failed to open db conn: ", zap.Error(err))
return err
}
defer db.Close()

log.Sugar().Info("Run migrations")
log.Info("Run migrations")
err = goose.Up(db, "migrations")
if err != nil {
log.Sugar().Error("Migration failed: ", err)
log.Error("Migration failed: ", zap.Error(err))
return err
}

Expand Down

0 comments on commit 09c9daa

Please sign in to comment.