user_devices table

The user_devices table in the Reddit Clone Database Schema schema has 8 columns, keyed by id, with 1 foreign key to users. 2 columns in user_sessions and push_subscriptions reference it.

A device outlives a session, which is why push tokens hang here and not on user_sessions. Logging out must not silently stop notifications on a device the person still owns.

Columns (8)

Columns of the user_devices table
ColumnTypeConstraintsDescription
iduuidprimary key
user_iduuidnot null, references users.id
platformdevice_platformnot null
device_namevarchar(120)
push_token_hashvarchar(255)
app_versionvarchar(40)
registered_attimestamptznot null
last_seen_attimestamptz

Indexes (1)

  • (user_id, platform)

Relationships