Fix production auth failures by applying email verification migration#64
Merged
A1L13N merged 2 commits intoJun 3, 2026
Conversation
WalkthroughThis change removes a fallback migration block from database initialization. The ChangesDatabase Initialization Cleanup
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
This fixes production authentication failures caused by the email verification schema not being present in the remote D1 database.
Changes
Result
Summary
This PR fixes production authentication failures caused by a missing email verification schema in the remote Cloudflare D1 database. The fix involves two key changes:
Changes Made
Updated Database Schema (
src/worker.py):init_db()function to rely on the predefined_DDLschema statements for all database setupALTER TABLE usersto add theemail_verifiedcolumn for existing tables_DDLnow comprehensively defines the complete schema, including theemail_verifiedcolumn (withDEFAULT 0) in the users table and the email verification token tablesD1 Migration Configuration:
migrations/0003_add_email_verification.sqlwhich includes:ALTER TABLE users ADD COLUMN email_verifiedImpact
email_verified = 0and receive a verification email with a single-use token valid for 24 hoursUPDATE users SET email_verified = 1statement, preserving accessThe approach simplifies the codebase by delegating schema migration to D1's migration system in production while ensuring development environments have the complete schema definition through
_DDL.