CREATE SEQUENCE IF NOT EXISTS shz.cms_outdoor_fair_job_id_seq
    START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;

CREATE TABLE IF NOT EXISTS shz.cms_outdoor_fair_job (
    id BIGINT NOT NULL DEFAULT nextval('shz.cms_outdoor_fair_job_id_seq'::regclass) PRIMARY KEY,
    fair_id BIGINT NOT NULL,
    company_id BIGINT NOT NULL,
    job_id BIGINT NOT NULL,
    create_by VARCHAR(64),
    create_time TIMESTAMP,
    update_by VARCHAR(64),
    update_time TIMESTAMP,
    remark VARCHAR(500),
    del_flag CHAR(1) DEFAULT '0'
);

CREATE UNIQUE INDEX IF NOT EXISTS uk_cms_outdoor_fair_job
    ON shz.cms_outdoor_fair_job (fair_id, job_id);

CREATE INDEX IF NOT EXISTS idx_cms_outdoor_fair_job_company
    ON shz.cms_outdoor_fair_job (fair_id, company_id);

COMMENT ON TABLE shz.cms_outdoor_fair_job IS '户外招聘会岗位关联表';
