package db import ( "context" "code.lila.network/adoralaura/go-urlsh/migrations" "github.com/rs/zerolog" "github.com/uptrace/bun" "github.com/uptrace/bun/migrate" ) func doMigrations(db *bun.DB, logger *zerolog.Logger) error { ctx := context.Background() migrator := migrate.NewMigrator(db, migrations.Migrations) migrator.Init(ctx) group, err := migrator.Migrate(ctx) if err != nil { return err } if group.IsZero() { logger.Info().Msg("No new database migrations to run") return nil } logger.Info().Msgf("Database got migrated to %s", group) return nil }