Skip to content

feat: Add migration fixer script (for branches) #6282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Feb 20, 2023

This PR adds a script to rename migrations for feature branches.

I got tired of manually updating migrations in my branch as new ones land on main, this script automates the process.

./coderd/database/migrations/fix_migration_numbers.sh
Last migration (main): 000099_template_version_variables.up.sql
Next migration number: 000100
Renaming 000097_add_shutdown_script_to_coder_agents.down.sql to 000100_add_shutdown_script_to_coder_agents.down.sql
Renaming 000097_add_shutdown_script_to_coder_agents.up.sql to 000100_add_shutdown_script_to_coder_agents.up.sql
Skipping testdata/fixtures/000091_lifecycle.up.sql, no matching migration in ./coderd/database/migrations
Renaming testdata/fixtures/000097_lifecycle.up.sql to testdata/fixtures/000100_lifecycle.up.sql
On branch mafredri/feat-shutdown-script-2
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	renamed:    000097_add_shutdown_script_to_coder_agents.down.sql -> 000100_add_shutdown_script_to_coder_agents.down.sql
	renamed:    000097_add_shutdown_script_to_coder_agents.up.sql -> 000100_add_shutdown_script_to_coder_agents.up.sql
	renamed:    testdata/fixtures/000097_lifecycle.up.sql -> testdata/fixtures/000100_lifecycle.up.sql

Run 'git commit' to commit the changes.

@mafredri mafredri force-pushed the mafredri/feat-add-migration-fixer branch from 19dca39 to 8d862e9 Compare February 20, 2023 13:33
@github-actions

This comment was marked as off-topic.

@github-actions github-actions bot added the stale This issue is like stale bread. label Feb 28, 2023
@github-actions github-actions bot closed this Mar 3, 2023
@mafredri mafredri removed the stale This issue is like stale bread. label Mar 6, 2023
@mafredri mafredri requested review from deansheather and mtojek and removed request for deansheather and mtojek March 6, 2023 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant