Skip to content

Commit 6dfeb32

Browse files
authored
Remove unnecessary param from Start function (#934)
`latestSchema` is no longer needed in the `Start` function of operations. Requires #931
1 parent 5b3c948 commit 6dfeb32

25 files changed

+27
-27
lines changed

pkg/migrations/migrations.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type Operation interface {
2020
// version in the database (through a view)
2121
// update the given views to expose the new schema version
2222
// Returns the table that requires backfilling, if any.
23-
Start(ctx context.Context, l Logger, conn db.DB, latestSchema string, s *schema.Schema) (*backfill.Task, error)
23+
Start(ctx context.Context, l Logger, conn db.DB, s *schema.Schema) (*backfill.Task, error)
2424

2525
// Complete will update the database schema to match the current version
2626
// after calling Start.
@@ -118,7 +118,7 @@ func (m *Migration) UpdateVirtualSchema(ctx context.Context, s *schema.Schema) e
118118
// Run `Start` on each operation using the fake DB. Updates will be made to
119119
// the in-memory schema `s` without touching the physical database.
120120
for _, op := range m.Operations {
121-
if _, err := op.Start(ctx, NewNoopLogger(), db, "", s); err != nil {
121+
if _, err := op.Start(ctx, NewNoopLogger(), db, s); err != nil {
122122
return err
123123
}
124124
}

pkg/migrations/op_add_column.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var (
1919
_ Createable = (*OpAddColumn)(nil)
2020
)
2121

22-
func (o *OpAddColumn) Start(ctx context.Context, l Logger, conn db.DB, latestSchema string, s *schema.Schema) (*backfill.Task, error) {
22+
func (o *OpAddColumn) Start(ctx context.Context, l Logger, conn db.DB, s *schema.Schema) (*backfill.Task, error) {
2323
l.LogOperationStart(o)
2424

2525
table := s.GetTable(o.Table)

pkg/migrations/op_alter_column.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var (
1818
_ Createable = (*OpAlterColumn)(nil)
1919
)
2020

21-
func (o *OpAlterColumn) Start(ctx context.Context, l Logger, conn db.DB, latestSchema string, s *schema.Schema) (*backfill.Task, error) {
21+
func (o *OpAlterColumn) Start(ctx context.Context, l Logger, conn db.DB, s *schema.Schema) (*backfill.Task, error) {
2222
l.LogOperationStart(o)
2323

2424
table := s.GetTable(o.Table)
@@ -81,7 +81,7 @@ func (o *OpAlterColumn) Start(ctx context.Context, l Logger, conn db.DB, latestS
8181
task := backfill.NewTask(table, triggers...)
8282
// perform any operation specific start steps
8383
for _, op := range ops {
84-
bf, err := op.Start(ctx, l, conn, latestSchema, s)
84+
bf, err := op.Start(ctx, l, conn, s)
8585
if err != nil {
8686
return nil, err
8787
}

pkg/migrations/op_change_type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type OpChangeType struct {
2020

2121
var _ Operation = (*OpChangeType)(nil)
2222

23-
func (o *OpChangeType) Start(ctx context.Context, l Logger, conn db.DB, latestSchema string, s *schema.Schema) (*backfill.Task, error) {
23+
func (o *OpChangeType) Start(ctx context.Context, l Logger, conn db.DB, s *schema.Schema) (*backfill.Task, error) {
2424
l.LogOperationStart(o)
2525

2626
table := s.GetTable(o.Table)

pkg/migrations/op_create_constraint.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var (
1616
_ Createable = (*OpCreateConstraint)(nil)
1717
)
1818

19-
func (o *OpCreateConstraint) Start(ctx context.Context, l Logger, conn db.DB, latestSchema string, s *schema.Schema) (*backfill.Task, error) {
19+
func (o *OpCreateConstraint) Start(ctx context.Context, l Logger, conn db.DB, s *schema.Schema) (*backfill.Task, error) {
2020
l.LogOperationStart(o)
2121

2222
table := s.GetTable(o.Table)

pkg/migrations/op_create_index.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var (
1818
_ Createable = (*OpCreateIndex)(nil)
1919
)
2020

21-
func (o *OpCreateIndex) Start(ctx context.Context, l Logger, conn db.DB, latestSchema string, s *schema.Schema) (*backfill.Task, error) {
21+
func (o *OpCreateIndex) Start(ctx context.Context, l Logger, conn db.DB, s *schema.Schema) (*backfill.Task, error) {
2222
l.LogOperationStart(o)
2323

2424
table := s.GetTable(o.Table)

pkg/migrations/op_create_table.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var (
1818
_ Createable = (*OpCreateTable)(nil)
1919
)
2020

21-
func (o *OpCreateTable) Start(ctx context.Context, l Logger, conn db.DB, latestSchema string, s *schema.Schema) (*backfill.Task, error) {
21+
func (o *OpCreateTable) Start(ctx context.Context, l Logger, conn db.DB, s *schema.Schema) (*backfill.Task, error) {
2222
l.LogOperationStart(o)
2323

2424
// Generate SQL for the columns in the table

pkg/migrations/op_drop_column.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var (
1515
_ Createable = (*OpDropColumn)(nil)
1616
)
1717

18-
func (o *OpDropColumn) Start(ctx context.Context, l Logger, conn db.DB, latestSchema string, s *schema.Schema) (*backfill.Task, error) {
18+
func (o *OpDropColumn) Start(ctx context.Context, l Logger, conn db.DB, s *schema.Schema) (*backfill.Task, error) {
1919
l.LogOperationStart(o)
2020

2121
var task *backfill.Task

pkg/migrations/op_drop_constraint.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
var _ Operation = (*OpDropConstraint)(nil)
1717

18-
func (o *OpDropConstraint) Start(ctx context.Context, l Logger, conn db.DB, latestSchema string, s *schema.Schema) (*backfill.Task, error) {
18+
func (o *OpDropConstraint) Start(ctx context.Context, l Logger, conn db.DB, s *schema.Schema) (*backfill.Task, error) {
1919
l.LogOperationStart(o)
2020

2121
table := s.GetTable(o.Table)

pkg/migrations/op_drop_index.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var (
1515
_ Createable = (*OpDropIndex)(nil)
1616
)
1717

18-
func (o *OpDropIndex) Start(ctx context.Context, l Logger, conn db.DB, latestSchema string, s *schema.Schema) (*backfill.Task, error) {
18+
func (o *OpDropIndex) Start(ctx context.Context, l Logger, conn db.DB, s *schema.Schema) (*backfill.Task, error) {
1919
l.LogOperationStart(o)
2020

2121
// no-op

0 commit comments

Comments
 (0)