Stores one-time password reset tokens with expiration and usage tracking.
| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| created_at | timestamp with time zone | now() | false | Time when the token was created. | ||
| deleted_at | timestamp with time zone | true | Timestamp when the record was deleted. If null, the record is not deleted. | |||
| expires_at | timestamp with time zone | (now() + ‘01:00:00’::interval) | false | Time after which the token becomes invalid. | ||
| id | uuid | gen_random_uuid() | false | A unique identifier for the resetting user password | ||
| token | uuid | false | Token sent to user for resetting their password. | |||
| updated_at | timestamp with time zone | now() | false | Time when the token was last updated. Automatically set by trigger. | ||
| used_at | timestamp with time zone | true | Time when the token was used. Null if unused. | |||
| user_id | uuid | false | public.users | References the user the token belongs to. |
| Name | Type | Definition |
|---|---|---|
| password_reset_tokens_created_at_not_null | n | NOT NULL created_at |
| password_reset_tokens_expires_at_not_null | n | NOT NULL expires_at |
| password_reset_tokens_id_not_null | n | NOT NULL id |
| password_reset_tokens_pkey | PRIMARY KEY | PRIMARY KEY (id) |
| password_reset_tokens_token_key | UNIQUE | UNIQUE (token) |
| password_reset_tokens_token_not_null | n | NOT NULL token |
| password_reset_tokens_updated_at_not_null | n | NOT NULL updated_at |
| password_reset_tokens_user_id_fkey | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE |
| password_reset_tokens_user_id_not_null | n | NOT NULL user_id |
| Name | Definition |
|---|---|
| password_reset_tokens_pkey | CREATE UNIQUE INDEX password_reset_tokens_pkey ON public.password_reset_tokens USING btree (id) |
| password_reset_tokens_token_key | CREATE UNIQUE INDEX password_reset_tokens_token_key ON public.password_reset_tokens USING btree (token) |
| unique_active_password_reset_tokens_user | CREATE UNIQUE INDEX unique_active_password_reset_tokens_user ON public.password_reset_tokens USING btree (user_id) WHERE ((deleted_at IS NULL) AND (used_at IS NULL)) |
| Name | Definition |
|---|---|
| set_timestamp | CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.password_reset_tokens FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp() |
Generated by tbls