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)

Columns of the email_change_requests table
ColumnTypeConstraintsDescription
iduuidprimary key
user_iduuidnot null, references users.id
new_emailvarchar(255)not null
token_hashvarchar(255)not null
created_attimestamptznot null
confirmed_attimestamptz

Indexes (1)

  • (user_id, created_at)

Relationships

  • email_change_requests.user_id references users.id