Skip to content

Commit

Permalink
fix: BED-5288 - reorder graph schema assertions and update migration …
Browse files Browse the repository at this point in the history
…information on every application version bump (#1064)
  • Loading branch information
zinic authored Jan 9, 2025
1 parent 6937675 commit 05cfad3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions cmd/api/src/migrations/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ func (s *GraphMigrator) executeMigrations(ctx context.Context, originalVersion v
}
}

if releaseVersion := version.GetVersion(); releaseVersion.GreaterThan(mostRecentVersion) {
mostRecentVersion = releaseVersion
}

if mostRecentVersion.GreaterThan(originalVersion) {
return UpdateMigrationData(ctx, s.db, mostRecentVersion)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/api/src/migrations/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func RequiresMigration(ctx context.Context, db graph.Database) (bool, error) {
return false, fmt.Errorf("unable to get graph db migration data: %w", err)
}
} else {
return LatestGraphMigrationVersion().GreaterThan(currentMigration), nil
return version.GetVersion().GreaterThan(currentMigration), nil
}
}

Expand Down
2 changes: 0 additions & 2 deletions packages/go/dawgs/drivers/pg/pg.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ func init() {
return nil, fmt.Errorf("expected string for configuration type but got %T", cfg)
} else if graphDB, err := newDatabase(connectionString); err != nil {
return nil, err
} else if err := graphDB.AssertSchema(ctx, graph.Schema{}); err != nil {
return nil, err
} else {
return graphDB, nil
}
Expand Down

0 comments on commit 05cfad3

Please sign in to comment.