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)

Columns of the recovery_codes table
ColumnTypeConstraintsDescription
iduuidprimary key
user_iduuidnot null, references users.id
code_hashvarchar(255)not null
used_attimestamptz

Indexes (1)

  • (user_id, used_at)

Relationships

  • recovery_codes.user_id references users.id