Skip to content

Commit

Permalink
fix: improve error message in missing migrations (#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfridman authored May 12, 2024
1 parent 42502ba commit a4de30e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ docker-postgres:
-p $(DB_POSTGRES_PORT):5432 \
-l goose_test \
postgres:14-alpine -c log_statement=all
echo "postgres://$(DB_USER):$(DB_PASSWORD)@localhost:$(DB_POSTGRES_PORT)/$(DB_NAME)?sslmode=disable"

docker-mysql:
docker run --rm -d \
Expand All @@ -112,6 +113,7 @@ docker-mysql:
-p $(DB_MYSQL_PORT):3306 \
-l goose_test \
mysql:8.0.31
echo "mysql://$(DB_USER):$(DB_PASSWORD)@localhost:$(DB_MYSQL_PORT)/$(DB_NAME)?parseTime=true"

docker-clickhouse:
docker run --rm -d \
Expand All @@ -122,6 +124,7 @@ docker-clickhouse:
-p $(DB_CLICKHOUSE_PORT):9000/tcp \
-l goose_test \
clickhouse/clickhouse-server:23-alpine
echo "clickhouse://$(DB_USER):$(DB_PASSWORD)@localhost:$(DB_CLICKHOUSE_PORT)/$(DB_NAME)"

docker-turso:
docker run --rm -d \
Expand Down
4 changes: 2 additions & 2 deletions up.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ func UpToContext(ctx context.Context, db *sql.DB, dir string, version int64, opt
output := fmt.Sprintf("version %d: %s", m.Version, m.Source)
collected = append(collected, output)
}
return fmt.Errorf("error: found %d missing migrations:\n\t%s",
len(missingMigrations), strings.Join(collected, "\n\t"))
return fmt.Errorf("error: found %d missing migrations before current version %d:\n\t%s",
len(missingMigrations), dbMaxVersion, strings.Join(collected, "\n\t"))
}
var migrationsToApply Migrations
if option.allowMissing {
Expand Down

0 comments on commit a4de30e

Please sign in to comment.