ALTER TABLE
    al_shift_setup
ADD
    CONSTRAINT `FK1_shift_type_id` FOREIGN KEY (`shift_type_id`) REFERENCES `al_shift_type` (`shift_type_id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    proll_filter_table
ADD
    CONSTRAINT `FK10_table_id` FOREIGN KEY (`table_id`) REFERENCES `al_shift_setup` (`shift_id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    proll_filter_table
ADD
    CONSTRAINT `FK1_glob_mkt_id` FOREIGN KEY (`glob_mkt_id`) REFERENCES `geo_company_groups` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    proll_filter_table
ADD
    CONSTRAINT `FK2_region_id` FOREIGN KEY (`region_id`) REFERENCES `geo_company_groups` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    proll_filter_table
ADD
    CONSTRAINT `FK3_sub_region_id` FOREIGN KEY (`sub_region_id`) REFERENCES `geo_company_groups` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    proll_filter_table
ADD
    CONSTRAINT `FK4_country_id` FOREIGN KEY (`country_id`) REFERENCES `geo_groups_countries` (`country_id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    proll_filter_table
ADD
    CONSTRAINT `FK5_state_id` FOREIGN KEY (`state_id`) REFERENCES `states` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    proll_filter_table
ADD
    CONSTRAINT `FK6_city_id` FOREIGN KEY (`city_id`) REFERENCES `cities` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    proll_filter_table
ADD
    CONSTRAINT `FK7_loc_id` FOREIGN KEY (`loc_id`) REFERENCES `proll_client_location` (`loc_id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    proll_filter_table
ADD
    CONSTRAINT `FK8_dept_id` FOREIGN KEY (`dept_id`) REFERENCES `department_hierarchy` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    proll_filter_table
ADD
    CONSTRAINT `FK9_desg_id` FOREIGN KEY (`desg_id`) REFERENCES `proll_client_designation` (`designation_id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    al_qrt_break
ADD
    CONSTRAINT `FK1_shift_id` FOREIGN KEY (`shift_id`) REFERENCES `al_shift_setup` (`shift_id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    al_roster
ADD
    CONSTRAINT `FK2_dept_id` FOREIGN KEY (`dept_id`) REFERENCES `proll_department_managers` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    al_roster
ADD
    CONSTRAINT `FK3_emp_id` FOREIGN KEY (`emp_id`) REFERENCES `proll_employee` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    al_roster
ADD
    CONSTRAINT `FK_al_roster_al_shift_setup` FOREIGN KEY (`shift_id`) REFERENCES `al_shift_setup` (`shift_id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE
    al_roster_overtime_cpl
ADD
    `calculate_on` ENUM('Day', 'Week', 'Month') NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci';

ALTER TABLE
    roster_config
ADD
    `cid` INT(11) NULL DEFAULT NULL;

ALTER TABLE
    roster_config
ADD
    `dept_id` INT(11) NULL DEFAULT NULL;

ALTER TABLE
    roster_config
ADD
    `threshold` ENUM('hour', 'half hour') NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci';

ALTER TABLE
    roster_config
ADD
    CONSTRAINT `FK1_dept_id` FOREIGN KEY (`dept_id`) REFERENCES `proll_department_managers` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;

RENAME TABLE roster_config TO al_roster_config;

ALTER TABLE
    al_shift_setup RENAME COLUMN late_arrival_01_mins TO consecutive_late;

ALTER TABLE
    al_shift_setup RENAME COLUMN late_arrival_02_mins TO late_arrival_tolerance;

ALTER TABLE
    al_shift_setup RENAME COLUMN late_arrival_01_mins_afc TO attendance_tolerance;

ALTER TABLE
    al_shift_setup
ALTER COLUMN
    mid_break_enable
SET
    DEFAULT '0';

ALTER TABLE
    al_shift_setup
ALTER COLUMN
    mid_break_time_in
SET
    DEFAULT '00:00:00';

ALTER TABLE
    al_shift_setup
ALTER COLUMN
    mid_break_time_out
SET
    DEFAULT '00:00:00';

ALTER TABLE
    al_shift_setup
ALTER COLUMN
    ext_mid_break_time_in
SET
    DEFAULT '00:00:00';

ALTER TABLE
    al_shift_setup
ALTER COLUMN
    ext_mid_break_time_out
SET
    DEFAULT '00:00:00';

ALTER TABLE
    al_shift_setup
ALTER COLUMN
    consecutive_late
SET
    DEFAULT '0';

ALTER TABLE
    al_shift_setup
ALTER COLUMN
    late_arrival_tolerance
SET
    DEFAULT '0';

ALTER TABLE
    al_shift_setup
ALTER COLUMN
    attendance_tolerance
SET
    DEFAULT '0';

ALTER TABLE
    al_shift_setup
MODIFY
    work_hours INT(11) NULL NOT NULL COMMENT 'if this shift will be flexible hour then in this will be store hours';

ALTER TABLE
    al_shift_setup
ALTER COLUMN
    revert_shift_id
SET
    DEFAULT '0';

ALTER TABLE
    al_shift_setup
ALTER COLUMN
    bl_view_status
SET
    DEFAULT '0';

ALTER TABLE
    al_shift_setup
ALTER COLUMN
    lm_view_status
SET
    DEFAULT '0';

ALTER TABLE
    al_shift_setup
ALTER COLUMN
    hr_view_status
SET
    DEFAULT '0';

ALTER TABLE
    al_shift_setup
MODIFY
    `modified_by` INT(11) NULL;

ALTER TABLE
    al_roster
MODIFY
    `modified_date` DATETIME NULL;

ALTER TABLE
    al_roster
MODIFY
    `modified_by` INT(11) NULL;

ALTER TABLE
    al_roster
ALTER COLUMN
    shift_hours
SET
    DEFAULT '0';

ALTER TABLE
    al_roster_overtime_cpl_log RENAME COLUMN `al_ros` TO `al_ros_ov_cpl`;