Skip to content

Commit

Permalink
fix: ignore missing table when listing remote migrations (#2573)
Browse files Browse the repository at this point in the history
fix: handle pgx query error in one place
  • Loading branch information
sweatybridge authored Jul 29, 2024
1 parent 1dedb59 commit a923832
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 1 addition & 4 deletions pkg/migration/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ import (

func ListRemoteMigrations(ctx context.Context, conn *pgx.Conn) ([]string, error) {
// We query the version string only for backwards compatibility
rows, err := conn.Query(ctx, LIST_MIGRATION_VERSION)
if err != nil {
return nil, errors.Errorf("failed to query rows: %w", err)
}
rows, _ := conn.Query(ctx, LIST_MIGRATION_VERSION)
versions, err := pgxv5.CollectStrings(rows)
if err != nil {
var pgErr *pgconn.PgError
Expand Down
1 change: 1 addition & 0 deletions pkg/pgxv5/rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

func CollectStrings(rows pgx.Rows) ([]string, error) {
defer rows.Close()
result := []string{}
for rows.Next() {
var version string
Expand Down

0 comments on commit a923832

Please sign in to comment.