Repository navigation
Squash migrations V1-V26 into one initial schema - #14
Merged
Merged
Conversation
V1__initial_schema.sql creates the schema the 26 migrations produced, plus the seeded admin with the working password hash. Verified by applying both to empty databases and diffing pg_dump output: identical apart from dropping idx_evt_token and idx_prt_token, which duplicated the indexes behind the UNIQUE (token) constraints. Existing databases are not migrated: they must be dropped and recreated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Replaces the 26 Flyway migrations with a single
V1__initial_schema.sqldescribing the schema as it is now. The history of tables created and then altered, the account/multi-tenancy columns added and dropped, the admin password fixed in V23 and the foreign keys redone in V24/V26 is gone.Is it the same schema?
I applied the old V1–V26 to one empty Postgres 16 database and the new V1 to another, then diffed
pg_dump --schema-only. They match exactly (tables, column order and types, defaults, check constraints, foreign keys with their delete rules, unique constraints, indexes, constraint names), except for one intended change:idx_evt_tokenandidx_prt_tokenare gone. They repeated the indexes Postgres already builds for theUNIQUE (token)constraints, so every token write updated two identical indexes.The seeded admin row is identical too (same values, including the working
ChangeMe123!hash andmust_change_pwd = true).Any database created with the old migrations must be dropped and recreated. Flyway would refuse to start on it, because its history lists V2–V26, which no longer exist, and a V1 with a different checksum. Agreed beforehand: no database needs keeping.
Also
V2__…), seeded-admin note.Testing