
-- @AutoRun
-- drop table tl_job_application;



CREATE TABLE tl_job_application (
    object_id numeric(12) NOT NULL ,
    object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
    object_created_date timestamp DEFAULT NOW() NOT NULL
    ,
    cv bytea NULL,
    cover_letter bytea NULL,
    application_status varchar(200) NOT NULL,
    submitted_date timestamp NULL,
    google_address_text varchar(300) NULL,
    prefer_remote char(1) NULL,
    happy_to_relocate char(1) NULL,
    is_email_ingest char(1) NULL,
    applicant_source varchar(200) NULL,
    candidate_id numeric(12)  NOT NULL,
    job_id numeric(12)  NOT NULL,
    work_flow_stage_id numeric(12)  NULL
    );



ALTER TABLE tl_job_application ADD    
    CONSTRAINT pk_tl_job_application PRIMARY KEY 
    (
        object_id
    ) ;
    
    
    
    CREATE INDEX idx_tl_job_application_candidate_id 
    ON tl_job_application (candidate_id);

    CREATE INDEX idx_tl_job_application_job_id 
    ON tl_job_application (job_id);
