Skip to main content

infra/sql/0011_portal_invites.sql

Metadata

Indexed Symbols

No indexed functions/methods detected in this file.

Markdown Headings (if applicable)

No markdown headings detected.

Source Preview

create table if not exists portal_invites (
id uuid primary key default gen_random_uuid(),
workspace_id uuid not null references workspaces(id) on delete cascade,
email text not null,
client_id uuid,
token_jti text not null unique,
token_subject text not null,
status text not null default 'active' check (status in ('active', 'revoked', 'expired')),
expires_at timestamptz not null,
created_by text not null,
created_at timestamptz not null default now(),
revoked_at timestamptz,
revoked_by text
);

create index if not exists idx_portal_invites_workspace_status
on portal_invites(workspace_id, status, created_at desc);