Skip to content

Commit

Permalink
WIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
efritz committed Sep 13, 2024
1 parent c8a00a6 commit a4143c7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions migration_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"slices"
"time"

"github.com/go-nacelle/log/v2"
"github.com/go-nacelle/nacelle/v2"
"github.com/jackc/pgconn"
)
Expand All @@ -17,7 +18,7 @@ type Runner struct {
locker *TransactionalLocker
}

// TODO - log more/better
// TODO - additional logging

func NewMigrationRunner(db DB, reader MigrationReader, logger nacelle.Logger) (*Runner, error) {
definitions, err := ReadMigrations(reader)
Expand Down Expand Up @@ -116,10 +117,6 @@ func (r *Runner) applyDefinitions(ctx context.Context, definitions []Definition,
return err
}

//
// TODO - need to store hash as well?
//

applied := map[int]struct{}{}
for _, log := range migrationLogs {
if log.Success != nil && *log.Success && !log.Reverse {
Expand Down Expand Up @@ -279,7 +276,9 @@ func (r *Runner) createIndexConcurrently(ctx context.Context, definition Definit
`, Args{
"id": id,
})); err != nil {
r.logger.Error("Failed to update heartbeat") // TODO - more information
r.logger.ErrorWithFields(log.LogFields{
"error": err,
}, "Failed to update heartbeat")
}

if err := wait(ctx, time.Second*5); err != nil {
Expand Down

0 comments on commit a4143c7

Please sign in to comment.