refresh_token

-1 rows


Columns

Column Type Size Nulls Auto Default Children Parents Comments
refresh_token_id uuid 2147483647 null
refresh_token.replaced_by_token_id fk_refresh_token_replacement_family R
user_id uuid 2147483647 null
user_account.user_id fk_refresh_token_user_company R
company_id uuid 2147483647 null
user_account.company_id fk_refresh_token_user_company R
token_family_id uuid 2147483647 null
refresh_token.token_family_id fk_refresh_token_replacement_family R
refresh_token.token_family_id fk_refresh_token_replacement_family R
token_hash varchar 64 null
expires_at timestamptz 35,6 null
used_at timestamptz 35,6 null
revoked_at timestamptz 35,6 null
replaced_by_token_id uuid 2147483647 null
refresh_token.refresh_token_id fk_refresh_token_replacement_family R
created_at timestamptz 35,6 CURRENT_TIMESTAMP
updated_at timestamptz 35,6 CURRENT_TIMESTAMP
version int8 19 0

Indexes

Constraint Name Type Sort Column(s)
pk_refresh_token Primary key Asc refresh_token_id
idx_refresh_token_company_user Performance Asc/Asc company_id + user_id
idx_refresh_token_expires_at Performance Asc expires_at
idx_refresh_token_family_revoked Performance Asc/Asc token_family_id + revoked_at
uq_refresh_token_hash Must be unique Asc token_hash
uq_refresh_token_id_family Must be unique Asc/Asc refresh_token_id + token_family_id
uq_refresh_token_replaced_by Must be unique Asc replaced_by_token_id

Check Constraints

Constraint Name Constraint
ck_refresh_token_replacement_used ((replaced_by_token_id IS NULL) OR (used_at IS NOT NULL))
ck_refresh_token_updated_at ((updated_at >= created_at) AND ((used_at IS NULL) OR (updated_at >= used_at)) AND ((revoked_at IS NULL) OR (updated_at >= revoked_at)))
ck_refresh_token_hash_length (char_length((token_hash)::text) = 64)
ck_refresh_token_expiry (expires_at > created_at)
ck_refresh_token_revoked_at ((revoked_at IS NULL) OR (revoked_at >= created_at))
ck_refresh_token_replacement ((replaced_by_token_id IS NULL) OR (replaced_by_token_id <> refresh_token_id))
ck_refresh_token_used_at ((used_at IS NULL) OR (used_at >= created_at))
ck_refresh_token_version (version >= 0)
ck_refresh_token_hash_lowercase ((token_hash)::text = lower((token_hash)::text))

Relationships