new-site/api/migrations/009_id_upload.sql
justin f8cd37ac8c Initial commit — Performance West telecom compliance platform
Includes: API (Express/TypeScript), Astro site, Python workers,
document generators, FCC compliance tools, Canada CRTC formation,
Ansible infrastructure, and deployment scripts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 06:54:22 -05:00

25 lines
879 B
PL/PgSQL

-- 009_id_upload.sql
-- One-time upload tokens for ID verification (Anytime Mailbox registration).
-- Supports both desktop file upload and mobile QR code → phone camera upload.
BEGIN;
CREATE TABLE IF NOT EXISTS id_upload_tokens (
id SERIAL PRIMARY KEY,
token TEXT UNIQUE NOT NULL,
order_type TEXT DEFAULT 'canada_crtc',
order_reference TEXT,
customer_email TEXT NOT NULL,
customer_name TEXT,
front_uploaded BOOLEAN DEFAULT FALSE,
back_uploaded BOOLEAN DEFAULT FALSE,
minio_paths JSONB DEFAULT '{}',
expires_at TIMESTAMPTZ NOT NULL,
used BOOLEAN DEFAULT FALSE,
created_at TIMESTAMPTZ DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_id_tokens_token ON id_upload_tokens(token);
CREATE INDEX IF NOT EXISTS idx_id_tokens_expires ON id_upload_tokens(expires_at);
COMMIT;