- gateway, companies, customers, job_seekers apps updated - users config/mod/mail handlers - auth middleware and jwt crate updates - db models: user, config, mod updates - all remaining migrations: portfolio, notifications, reviews, kb, support, coupons, onboarding states Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
16 lines
814 B
SQL
16 lines
814 B
SQL
-- Onboarding state per user per role
|
|
-- Tracks progress through the schema-driven onboarding form
|
|
CREATE TABLE IF NOT EXISTS onboarding_states (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
role_id UUID NOT NULL REFERENCES roles(id) ON DELETE CASCADE,
|
|
status VARCHAR(20) NOT NULL DEFAULT 'NOT_STARTED', -- NOT_STARTED | IN_PROGRESS | COMPLETED
|
|
progress_json JSONB NOT NULL DEFAULT '{}',
|
|
completed_at TIMESTAMPTZ,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
-- One onboarding state record per user per role
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_onboarding_state_user_role
|
|
ON onboarding_states(user_id, role_id);
|