
-- @AutoRun
-- drop table tl_assessment_template;



CREATE TABLE tl_assessment_template (
    object_id numeric(12) NOT NULL ,
    object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
    object_created_date timestamp DEFAULT NOW() NOT NULL
    ,
    template_name varchar(100) NULL,
    job_title varchar(60) NOT NULL,
    job_description text NOT NULL,
    ref_number varchar(10) NULL,
    google_address_text varchar(300) NOT NULL,
    location_radius varchar(200) NOT NULL,
    remote char(1) NULL,
    job_type varchar(200) NOT NULL,
    industry varchar(200) NOT NULL,
    require_cv char(1) NULL,
    assessment_type varchar(200) NOT NULL,
    include_assessment_criteria char(1) NOT NULL,
    level_id numeric(12)  NULL,
    occupation_id numeric(12)  NOT NULL,
    job_owner_id numeric(12)  NULL,
    job_id numeric(12)  NULL,
    client_id numeric(12)  NULL,
    hiring_team_id numeric(12)  NULL,
    company_user_id numeric(12)  NULL,
    job_title_id numeric(12)  NOT NULL,
    work_flow_template_id numeric(12)  NULL
    );



ALTER TABLE tl_assessment_template ADD    
    CONSTRAINT pk_tl_assessment_template PRIMARY KEY 
    (
        object_id
    ) ;
    
    
    
        CREATE UNIQUE INDEX idx_tl_assessment_template_TemplateID ON 
        tl_assessment_template (template_name, hiring_team_id, company_user_id);
    