customer/migrations/0007_hr.sql
Peppa 2669ad01ab
All checks were successful
peppa/lint lint: success за 1с
peppa/typecheck typecheck: success за 2с
peppa/test test: success за 37с
peppa/build build: success за 2с
ci / checks (pull_request) Successful in 50s
deploy / deploy (pull_request) Successful in 3s
CLT-8: HR-скрининг кандидатов со скоринговым отчётом
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 14:51:57 +05:00

23 lines
886 B
SQL

CREATE TABLE hr_balances (
user_id uuid PRIMARY KEY REFERENCES users (id) ON DELETE CASCADE,
credits integer NOT NULL DEFAULT 0 CHECK (credits >= 0)
);
-- Ответы кандидата не хранятся: только метка от HR, согласие и баллы.
CREATE TABLE hr_invites (
id uuid PRIMARY KEY,
user_id uuid NOT NULL REFERENCES users (id) ON DELETE CASCADE,
token_hash text NOT NULL UNIQUE,
position text NOT NULL CHECK (position IN ('operator', 'sales')),
label text NOT NULL,
status text NOT NULL DEFAULT 'new' CHECK (status IN ('new', 'started', 'completed', 'expired')),
created_at timestamptz NOT NULL,
expires_at timestamptz NOT NULL,
consent_at timestamptz,
consent_version text,
started_at timestamptz,
completed_at timestamptz,
result jsonb
);
CREATE INDEX hr_invites_user_idx ON hr_invites (user_id, created_at DESC);