<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `hr_employee_schedules` (
            `id`                    BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `employee_profile_id`   BIGINT UNSIGNED NOT NULL,
            `schedule_id`           BIGINT UNSIGNED NOT NULL,
            `effective_from`        DATE NOT NULL,
            `effective_to`          DATE NULL,
            `is_active`             TINYINT(1) NOT NULL DEFAULT 1,
            `created_at`            TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
            `updated_at`            TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
            `created_by`            BIGINT UNSIGNED NULL,
            `updated_by`            BIGINT UNSIGNED NULL,
            INDEX `idx_hr_emp_sched_employee` (`employee_profile_id`),
            INDEX `idx_hr_emp_sched_schedule` (`schedule_id`),
            INDEX `idx_hr_emp_sched_dates` (`effective_from`, `effective_to`),
            CONSTRAINT `fk_hr_emp_sched_employee` FOREIGN KEY (`employee_profile_id`) REFERENCES `hr_employee_profiles`(`id`),
            CONSTRAINT `fk_hr_emp_sched_schedule` FOREIGN KEY (`schedule_id`) REFERENCES `hr_work_schedules`(`id`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `hr_employee_schedules`",
];
