feat(migration): add up and down migration for password_hash column#278
Open
leandromasotti wants to merge 1 commit into
Open
feat(migration): add up and down migration for password_hash column#278leandromasotti wants to merge 1 commit into
leandromasotti wants to merge 1 commit into
Conversation
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.
Fix duplicate migration filenames (#203)
Two migration pairs shared the same
2026061001date counter, violating theYYYYMMDDNN_<description>.{up,down}.sqlconvention that requires a unique<NN>per day.Changes
git mv, history preserved):2026061001_add_user_password_hash.{up,down}.sql→2026061002_add_user_password_hash.{up,down}.sql.2026061001_add_password_hashas the canonical migration — it's the one that matchesdatabase/schema.sqlexactly (password_hash VARCHAR(255) NOT NULL, no default). The renamed pair usesNOT NULL DEFAULT '', which diverges from the schema.2026061002.database/migrations/README.md: completed the migration listing table and added a note explaining the01/02relationship and referencing this issue.Acceptance criteria
✅ Each migration pair now has a unique counter: 2026051501, 2026061001, 2026061002.
✅ Applying migrations in order reproduces schema.sql: 01 creates password_hash VARCHAR(255) NOT NULL (no default); 02 becomes a no-op via IF NOT EXISTS. Final state matches the schema.
✅ Migration documentation is up to date.
Heads-up / open question
Both migrations add the same
users.password_hashcolumn, so2026061002is effectively a redundant re-add (itsupis a no-op after01). This PR follows the ticket literally by renaming rather than deleting. There's also a minor rollback footgun: the02 downrunsDROP COLUMN IF EXISTS password_hash, so rolling back only02would drop the column actually introduced by01.If the team prefers, I'm happy to instead delete the redundant
2026061002_add_user_password_hashpair entirely (keeping only the canonical2026061001_add_password_hash), which removes the no-op migration and the rollback footgun. Just let me know and I'll update the PR.