Skip to content

Commit

Permalink
chore: appease linter, initialize struct with named fields
Browse files Browse the repository at this point in the history
  • Loading branch information
bevzzz committed Oct 27, 2024
1 parent 733c758 commit e7e7c4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions migrate/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ AddedLoop:
for _, removed := range removedTables.Values() {
if d.canRename(removed, added) {
d.changes.Add(&RenameTable{
FQN: schema.FQN{removed.Schema, removed.Name},
FQN: schema.FQN{Schema: removed.Schema, Table: removed.Name},
NewName: added.Name,
})

Expand All @@ -52,7 +52,7 @@ AddedLoop:
}
// If a new table did not appear because of the rename operation, then it must've been created.
d.changes.Add(&CreateTable{
FQN: schema.FQN{added.Schema, added.Name},
FQN: schema.FQN{Schema: added.Schema, Table: added.Name},
Model: added.Model,
})
created.Add(added)
Expand All @@ -62,7 +62,7 @@ AddedLoop:
dropped := currentTables.Sub(targetTables)
for _, t := range dropped.Values() {
d.changes.Add(&DropTable{
FQN: schema.FQN{t.Schema, t.Name},
FQN: schema.FQN{Schema: t.Schema, Table: t.Name},
})
}

Expand Down Expand Up @@ -339,7 +339,7 @@ func (d *detector) makeTargetColDef(current, target sqlschema.Column) sqlschema.

// detechColumnChanges finds renamed columns and, if checkType == true, columns with changed type.
func (d *detector) detectColumnChanges(current, target sqlschema.Table, checkType bool) {
fqn := schema.FQN{target.Schema, target.Name}
fqn := schema.FQN{Schema: target.Schema, Table: target.Name}

ChangedRenamed:
for tName, tCol := range target.Columns {
Expand Down Expand Up @@ -397,7 +397,7 @@ ChangedRenamed:
}

func (d *detector) detectConstraintChanges(current, target sqlschema.Table) {
fqn := schema.FQN{target.Schema, target.Name}
fqn := schema.FQN{Schema: target.Schema, Table: target.Name}

Add:
for _, want := range target.UniqueContraints {
Expand Down
2 changes: 1 addition & 1 deletion migrate/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var _ Operation = (*RenameTable)(nil)

func (op *RenameTable) GetReverse() Operation {
return &RenameTable{
FQN: schema.FQN{op.FQN.Schema, op.NewName},
FQN: schema.FQN{Schema: op.FQN.Schema, Table: op.NewName},
NewName: op.FQN.Table,
}
}
Expand Down

0 comments on commit e7e7c4f

Please sign in to comment.