HR-ATS-Portal/docker/postgres/initdb/01-init.sql

18 lines
691 B
SQL

-- Runs once, on first initialisation of an empty data volume.
-- Timestamps are stored tz-aware and read back as UTC by the backend.
ALTER SYSTEM SET timezone TO 'UTC';
ALTER SYSTEM SET log_timezone TO 'UTC';
-- Known migration gap in the inbox module: Alembic autogeneration creates every
-- table on first boot, but not this enum type, and a brand-new database fails
-- without it (README "Fresh database — one manual step").
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'candidate_application_status') THEN
CREATE TYPE candidate_application_status AS ENUM
('PROCESS','PENDING','APPROVED','REJECTED','ONHOLD','CLOSED');
END IF;
END
$$;