-- 022_job_post_requisition_unique.sql -- 021 originally created a non-unique ix_job_posts_requisition_id. Replace it -- with a unique index so the optional job_posts.requisition_id link is 1:1. -- Postgres unique indexes allow multiple NULLs. Applied at startup by -- alembic_setup.run_manual_sql(). Needed because prod boots with -- DB_AUTOGENERATE=false. DROP INDEX IF EXISTS app.ix_job_posts_requisition_id; CREATE UNIQUE INDEX IF NOT EXISTS uq_job_posts_requisition_id ON app.job_posts (requisition_id);