username_history table

The username_history table in the Reddit Clone Database Schema schema has 6 columns, keyed by id, with 2 foreign keys to users.

Indexed on old_username so an abandoned handle cannot be re-registered and used to impersonate its previous owner.

Columns (6)

Columns of the username_history table
ColumnTypeConstraintsDescription
iduuidprimary key
user_iduuidnot null, references users.id
old_usernamevarchar(20)not null
new_usernamevarchar(20)not null
changed_byuuidreferences users.id
changed_attimestamptznot null

Indexes (2)

  • (user_id, changed_at)
  • (old_username)

Relationships

  • username_history.user_id references users.id
  • username_history.changed_by references users.id