Skip to content

Commit

Permalink
Pass *schema.Schema argument to Complete calls
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-farries committed Jan 15, 2024
1 parent a185e8c commit 7c8ebc7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/migrations/op_alter_column.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (o *OpAlterColumn) Start(ctx context.Context, conn *sql.DB, stateSchema str
func (o *OpAlterColumn) Complete(ctx context.Context, conn *sql.DB, s *schema.Schema) error {
op := o.innerOperation()

return op.Complete(ctx, conn)
return op.Complete(ctx, conn, s)
}

func (o *OpAlterColumn) Rollback(ctx context.Context, conn *sql.DB) error {
Expand Down
8 changes: 7 additions & 1 deletion pkg/roll/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,15 @@ func (m *Roll) Complete(ctx context.Context) error {
}
}

// read the current schema
schema, err := m.state.ReadSchema(ctx, m.schema)
if err != nil {
return fmt.Errorf("unable to read schema: %w", err)
}

// execute operations
for _, op := range migration.Operations {
err := op.Complete(ctx, m.pgConn)
err := op.Complete(ctx, m.pgConn, schema)
if err != nil {
return fmt.Errorf("unable to execute complete operation: %w", err)
}
Expand Down

0 comments on commit 7c8ebc7

Please sign in to comment.