Files
compor-academy/server/migrations/004_account_access_tokens.sql
Cauê Faleiros 4736fb5208
All checks were successful
CI / Validate frontend and API (push) Successful in 50s
CI / Build and publish Docker images (push) Successful in 20s
feat: expand admin and instructor tools
2026-09-01 13:19:29 -03:00

16 lines
576 B
SQL

create type account_token_purpose as enum ('invitation', 'password_reset');
create table account_access_tokens (
id uuid primary key default gen_random_uuid(),
email text not null,
role user_role not null default 'student',
purpose account_token_purpose not null,
token_hash text not null unique,
expires_at timestamptz not null,
used_at timestamptz,
created_by uuid not null references users(id),
created_at timestamptz not null default now()
);
create index account_access_tokens_lookup_index on account_access_tokens (token_hash) where used_at is null;