CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
0048_email_verification.sql
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| c63b860 | 1 | -- Block P2 — Email verification + welcome email. |
| 2 | -- Strictly additive. Adds an opt-in verification timestamp to `users` and a | |
| 3 | -- token table whose rows are SHA-256 hashed (we never persist plaintext). | |
| 4 | ||
| 5 | ALTER TABLE users | |
| 6 | ADD COLUMN IF NOT EXISTS email_verified_at timestamptz; | |
| 7 | ||
| 8 | CREATE TABLE IF NOT EXISTS email_verification_tokens ( | |
| 9 | id uuid PRIMARY KEY DEFAULT gen_random_uuid(), | |
| 10 | user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE, | |
| 11 | email text NOT NULL, -- the email being verified (in case of email change) | |
| 12 | token_hash text NOT NULL UNIQUE, | |
| 13 | expires_at timestamptz NOT NULL, | |
| 14 | used_at timestamptz, | |
| 15 | created_at timestamptz NOT NULL DEFAULT now() | |
| 16 | ); | |
| 17 | CREATE INDEX IF NOT EXISTS idx_email_verify_tokens_user ON email_verification_tokens (user_id); |