Skip to content

feat(scripts): add script to check schema between migrations #13037

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 4 commits into from
Apr 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup comment
  • Loading branch information
johnstcn authored Apr 22, 2024
commit 24ac2afec774d1fdf956e3e3992cea0e597b76c9
10 changes: 4 additions & 6 deletions scripts/migrate-test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ import (
// This script validates the migration path
// between two versions.
// It performs the following actions:
// Given OLD_VERSION, NEW_VERSION, and MAINLINE_VERSION:
// 1. Clones coder/coder to a temporary directory
// 2. Creates a temporary database (Docker)
// 3. Checks out $OLD_VERSION and inits schema at that version.
// 4. Checks out $NEW_VERSION and runs migrations.
// 5. Compares database schema pre-migrate to post-migrate.
// Given OLD_VERSION and NEW_VERSION:
// 1. Checks out $OLD_VERSION and inits schema at that version.
// 2. Checks out $NEW_VERSION and runs migrations.
// 3. Compares database schema post-migrate to that in VCS.
// If any diffs are found, exits with an error.
func main() {
Copy link
Member

Choose a reason for hiding this comment

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

Who/what/when is going to run this script? The hidden question is: can somebody forget to run it and there will be a disaster?

Copy link
Member Author

Choose a reason for hiding this comment

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

Point 👍 I need to add this to the CI workflow so it gets run on each commit.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, it makes more sense to integrate with the script Mathias is working on. I'll add a Makefile target at least for now.

var (
Expand Down
Loading