Skip to content
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

Schema migrations: detect and reject conflicting schema names #4531

Closed
jgallagher opened this issue Nov 20, 2023 · 0 comments · Fixed by #4546
Closed

Schema migrations: detect and reject conflicting schema names #4531

jgallagher opened this issue Nov 20, 2023 · 0 comments · Fixed by #4546

Comments

@jgallagher
Copy link
Contributor

One symptom of #4530 was that we had a migration directory containing both up1.sql and up01.sql (and additional higher numbers), caused by incorrect git merge / move operations while trying to land two unrelated PRs that both added new migrations. We should detect this, ideally at CI test time, to at least catch "this directory seems to contain two different sets of migrations".

karencfv pushed a commit to karencfv/omicron that referenced this issue Nov 21, 2023
This was accidentally merged in with 11.0.0 in oxidecomputer#3804

Fixes oxidecomputer#4530 (but see oxidecomputer#4531 for followup work)
sunshowers pushed a commit that referenced this issue Nov 22, 2023
Fixes #4531.

If I cherry-pick these changes onto `main` just prior to #4529 (i.e.,
when the `11.0.0` directory contained upsql files for both 10.0.0 and
11.0.0), the `dbinit_equals_sum_of_all_up` integration test fails as
desired:

```
thread 'integration_tests::schema::dbinit_equals_sum_of_all_up' panicked at nexus/tests/integration_tests/schema.rs:133:58:
called `Result::unwrap()` on an `Err` value: "invalid `up*.sql` combination: /data/github/omicron/nexus/../schema/crdb/11.0.0/up01.sql, /data/github/omicron/nexus/../schema/crdb/11.0.0/up1.sql"
```
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 a pull request may close this issue.

1 participant