recovery_codes table
The recovery_codes table in the Reddit Clone Database Schema schema has 4 columns, keyed by id, with 1 foreign key to users.
One row per single-use code. Used is a timestamp, never a delete, so support can see that a code was burned rather than guess.
Columns (4)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| user_id | uuid | not null, references users.id | |
| code_hash | varchar(255) | not null | |
| used_at | timestamptz |
Indexes (1)
(user_id, used_at)
Relationships
recovery_codes.user_idreferencesusers.id