Skip to content

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

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

Merged
merged 2 commits into from
Mar 7, 2023

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Mar 6, 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 self-assigned this Mar 6, 2023
@mafredri mafredri requested review from deansheather and mtojek March 6, 2023 20:07
@mafredri
Copy link
Member Author

mafredri commented Mar 6, 2023

(Couldn't re-open previous PR #6282 so created a new one)

Copy link
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice bashing!

@mtojek mtojek self-requested a review March 7, 2023 12:46
@mafredri mafredri merged commit 0c2b432 into main Mar 7, 2023
@mafredri mafredri deleted the mafredri/feat-add-migration-fixer branch March 7, 2023 12:47
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.

3 participants