email_change_requests table
The email_change_requests table in the Reddit Clone Database Schema schema has 6 columns, keyed by id, with 1 foreign key to users.
The new address lives here until it is confirmed and only then moves to users.email. Writing it straight onto the account is how people lock themselves out with a typo.
Columns (6)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| user_id | uuid | not null, references users.id | |
| new_email | varchar(255) | not null | |
| token_hash | varchar(255) | not null | |
| created_at | timestamptz | not null | |
| confirmed_at | timestamptz |
Indexes (1)
(user_id, created_at)
Relationships
email_change_requests.user_idreferencesusers.id