Bump a database migration's timestamp to the current time. Required when a PR's migration is older than one already merged to main. Use when asked to "bump migration", "update migration timestamp", or when a migration ordering conflict is detected.
Bump the migration: $ARGUMENTS
This is required when a PR has a database migration with a timestamp older than a migration already merged to main. This happens when a PR has been pending merge for a while and another PR got merged with a more recent migration.
If the user provided a filename, use that. Otherwise, find migrations on this branch that are older than the latest on main:
# List migrations on this branch that aren't on main
git diff origin/main --name-only -- server/datastore/mysql/migrations/tables/
The tool lives at tools/bump-migration/main.go. Run it from the repo root:
go run tools/bump-migration/main.go --source-migration YYYYMMDDHHMMSS_MigrationName.go
This will:
Up_OLDTS → Up_NEWTS, Down_OLDTS → Down_NEWTS, TestUp_OLDTS → TestUp_NEWTS)If the migration affects the schema, add --regen-schema to also run make dump-test-schema:
go run tools/bump-migration/main.go --source-migration YYYYMMDDHHMMSS_MigrationName.go --regen-schema
go build ./server/datastore/mysql/migrations/... to check compilation