CREATE TABLE hs_hr_compstructtree (title TEXT NOT NULL, description TEXT NOT NULL, lft INT DEFAULT '0' NOT NULL, rgt INT DEFAULT '0' NOT NULL, id INT, parnt INT DEFAULT '0' NOT NULL, loc_code VARCHAR(13), dept_id VARCHAR(32), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE hs_hr_emp_kpi (kpi_code BIGINT, kpi_desc VARCHAR(200), kpi_min_rate INT, kpi_max_rate INT, kpi_default_scale TINYINT, PRIMARY KEY(kpi_code)) ENGINE = INNODB;
CREATE TABLE hs_hr_employee (emp_number INT, emp_lastname VARCHAR(100) DEFAULT '' NOT NULL, emp_firstname VARCHAR(100) DEFAULT '' NOT NULL, emp_middle_name VARCHAR(100) DEFAULT '' NOT NULL, emp_nick_name VARCHAR(100) DEFAULT NULL, emp_smoker SMALLINT DEFAULT '0', emp_ssn_num VARCHAR(100) DEFAULT NULL, emp_sin_num VARCHAR(100) DEFAULT NULL, emp_other_id VARCHAR(100) DEFAULT NULL, emp_dri_lice_num VARCHAR(100) DEFAULT NULL, emp_military_service VARCHAR(100) DEFAULT NULL, emp_street1 VARCHAR(100) DEFAULT NULL, emp_street2 VARCHAR(100) DEFAULT NULL, city_code VARCHAR(100) DEFAULT NULL, coun_code VARCHAR(100) DEFAULT NULL, provin_code VARCHAR(100) DEFAULT NULL, employee_id VARCHAR(50), ethnic_race_code VARCHAR(13), emp_birthday DATE, nation_code VARCHAR(13), emp_gender SMALLINT, emp_marital_status VARCHAR(20), emp_dri_lice_exp_date DATE, emp_status VARCHAR(13), job_title_code VARCHAR(13), eeo_cat_code VARCHAR(13), work_station INT, emp_zipcode VARCHAR(20), emp_hm_telephone VARCHAR(50), emp_mobile VARCHAR(50), emp_work_telephone VARCHAR(50), emp_work_email VARCHAR(50), sal_grd_code VARCHAR(13), joined_date DATE, emp_oth_email VARCHAR(50), terminated_date DATE, termination_reason TEXT, custom1 VARCHAR(250), custom2 VARCHAR(250), custom3 VARCHAR(250), custom4 VARCHAR(250), custom5 VARCHAR(250), custom6 VARCHAR(250), custom7 VARCHAR(250), custom8 VARCHAR(250), custom9 VARCHAR(250), custom10 VARCHAR(250), PRIMARY KEY(emp_number)) ENGINE = INNODB;
CREATE TABLE hs_hr_kpi (id VARCHAR(13), job_title_code VARCHAR(13), description VARCHAR(200), rate_min INT, rate_max INT, rate_default TINYINT, PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE hs_hr_empstat (estat_code VARCHAR(13), estat_name VARCHAR(50), PRIMARY KEY(estat_code)) ENGINE = INNODB;
CREATE TABLE hs_hr_job_title (jobtit_code VARCHAR(13), jobtit_name VARCHAR(50), jobtit_desc VARCHAR(200), jobtit_comm TEXT, sal_grd_code VARCHAR(13), jobspec_id INT, PRIMARY KEY(jobtit_code)) ENGINE = INNODB;
CREATE TABLE hs_hr_performance_review (employee_id VARCHAR(13), reviewer_id VARCHAR(13), review_period_from DATE, review_period_to DATE, review_date DATE, due_date DATE, review_comment VARCHAR(200), review_state VARCHAR(13), PRIMARY KEY(employee_id)) ENGINE = INNODB;
CREATE TABLE hs_hr_performance_reviewed_kpi (id BIGINT AUTO_INCREMENT, employee_id VARCHAR(13), job_title_code VARCHAR(13), kpi_id VARCHAR(13), rating INT, comment VARCHAR(200), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE hs_hr_emp_reportto (erep_sup_emp_number INT, erep_sub_emp_number INT, erep_reporting_mode SMALLINT, PRIMARY KEY(erep_sup_emp_number, erep_sub_emp_number, erep_reporting_mode)) ENGINE = INNODB;
CREATE TABLE hs_hr_unique_id (id INT AUTO_INCREMENT, last_id INT UNSIGNED NOT NULL, table_name VARCHAR(50) NOT NULL, field_name VARCHAR(50) NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB;
