chore: add script to analyze which releases have migrations #10823
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is this?
This is a little script that can help find which release upgrades have database migrations and which migrations they have. I created this to investigate how difficult downgrading coder would be. I believe this has value outside of that though too. I have manually dug into migrations trying to find what release a migration landed in, this could have been useful.
I wrote this in Go rather than bash because I prefer golang.
How to use it?
Find all migrations between 2 versions
Going from 2.3.0 to 2.4.0
Looking at all patch releases after v2
Seeing all the noise this thing can make
This shows when every migration was introduced.
$ go run scripts/releasemigrations/main.go --patches --minors --majors --list # ... 2023/11/21 11:48:31 [minor] 5 migrations added between v2.2.1 and v2.3.0 2023/11/21 11:48:31 coderd/database/migrations/000160_provisioner_job_status.up.sql 2023/11/21 11:48:31 coderd/database/migrations/000161_workspace_agent_stats_template_id_created_at_user_id_include_sessions.up.sql 2023/11/21 11:48:31 coderd/database/migrations/000162_workspace_automatic_updates.up.sql 2023/11/21 11:48:31 coderd/database/migrations/000163_external_auth_extra.up.sql 2023/11/21 11:48:31 coderd/database/migrations/000164_archive_template_versions.up.sql 2023/11/21 11:48:31 [patch] 1 migrations added between v2.3.0 and v2.3.1 2023/11/21 11:48:31 coderd/database/migrations/000165_prevent_autostart_days.up.sql 2023/11/21 11:48:31 [patch] 1 migrations added between v2.3.1 and v2.3.2 2023/11/21 11:48:31 coderd/database/migrations/000166_template_active_version.up.sql 2023/11/21 11:48:31 [patch] 1 migrations added between v2.3.2 and v2.3.3 2023/11/21 11:48:31 coderd/database/migrations/000167_workspace_agent_api_version.up.sql 2023/11/21 11:48:31 [minor] 1 migrations added between v2.3.3 and v2.4.0 2023/11/21 11:48:31 coderd/database/migrations/000168_pg_coord_tailnet_v2_api.up.sql 2023/11/21 11:48:31 Patches: 122 (55 with migrations) 2023/11/21 11:48:31 Minors: 31 (26 with migrations) 2023/11/21 11:48:31 Majors: 1 (1 with migrations)