Stores single-use codes for actions like user account deletion verification.
| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| code | varchar(16) | false | The single-use code sent to the user. | |||
| created_at | timestamp with time zone | now() | false | Time when the code 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 code becomes invalid. | ||
| id | uuid | gen_random_uuid() | false | A unique identifier for this code record | ||
| updated_at | timestamp with time zone | now() | false | Time when the code was last updated. Automatically set by trigger. | ||
| used_at | timestamp with time zone | true | Time when the code was used. Null if unused. | |||
| user_id | uuid | false | public.users | References the user the code belongs to. |
| Name | Type | Definition |
|---|---|---|
| user_email_codes_code_not_null | n | NOT NULL code |
| user_email_codes_created_at_not_null | n | NOT NULL created_at |
| user_email_codes_expires_at_not_null | n | NOT NULL expires_at |
| user_email_codes_id_not_null | n | NOT NULL id |
| user_email_codes_pkey | PRIMARY KEY | PRIMARY KEY (id) |
| user_email_codes_updated_at_not_null | n | NOT NULL updated_at |
| user_email_codes_user_id_fkey | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE |
| user_email_codes_user_id_not_null | n | NOT NULL user_id |
| Name | Definition |
|---|---|
| unique_active_user_email_codes_user | CREATE UNIQUE INDEX unique_active_user_email_codes_user ON public.user_email_codes USING btree (user_id, code) WHERE ((deleted_at IS NULL) AND (used_at IS NULL)) |
| user_email_codes_pkey | CREATE UNIQUE INDEX user_email_codes_pkey ON public.user_email_codes USING btree (id) |
| Name | Definition |
|---|---|
| set_timestamp | CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.user_email_codes FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp() |
Generated by tbls