sessions table
The sessions table in the Social Media Database Schema schema has 9 columns, keyed by id, with 1 foreign key to users.
One row per signed-in device. revoked_at null means live, which is what powers a log-out-everywhere button.
Columns (9)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| user_id | uuid | not null, references users.id | |
| device_name | varchar(120) | ||
| ip_address | varchar(45) | ||
| user_agent | varchar(500) | ||
| push_token | varchar(255) | ||
| created_at | timestamptz | not null | |
| last_seen_at | timestamptz | not null | |
| revoked_at | timestamptz |
Indexes (1)
(user_id, last_seen_at)
Relationships
sessions.user_idreferencesusers.id