
-- DROP TABLE tl_assessment_template;



CREATE TABLE tl_assessment_template (
    object_id int NOT NULL ,
    object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
    object_created_date datetime DEFAULT getdate() NOT NULL
    ,
    template_name varchar(100) NULL,
    job_title varchar(30) NOT NULL,
    job_description text NOT NULL,
    ref_number varchar(10) NULL,
    google_address_text varchar(300) NULL,
    location_radius varchar(200) NOT NULL,
    remote char(1) NULL,
    job_type varchar(200) NOT NULL,
    industry varchar(200) 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)  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);
    