HR-ATS-Portal/backend/migrations/manual/032_inbox_rescan_runs.sql

27 lines
938 B
SQL

-- 032_inbox_rescan_runs.sql
-- On-Hold catalogue ATS rescan: one run row so the Inbox ReScan button can
-- poll progress while workers score (candidate, job_post) pairs.
CREATE TABLE IF NOT EXISTS app.inbox_rescan_runs (
id uuid PRIMARY KEY,
status varchar NOT NULL DEFAULT 'queued',
channel varchar NOT NULL DEFAULT 'all',
sheet varchar,
task_id varchar,
created_by uuid REFERENCES app.users (id),
job_count integer NOT NULL DEFAULT 0,
candidate_count integer NOT NULL DEFAULT 0,
skipped_candidates integer NOT NULL DEFAULT 0,
skipped_pairs integer NOT NULL DEFAULT 0,
pair_count integer NOT NULL DEFAULT 0,
done_count integer NOT NULL DEFAULT 0,
entries jsonb,
error text,
created_at timestamptz NOT NULL DEFAULT now(),
started_at timestamptz,
finished_at timestamptz
);
CREATE INDEX IF NOT EXISTS ix_inbox_rescan_runs_status
ON app.inbox_rescan_runs (status);