<?php
declare(strict_types=1);

return [
    'up' => "
CREATE TABLE IF NOT EXISTS `employee_branches` (
    `id`           BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `employee_id`  BIGINT UNSIGNED NOT NULL,
    `branch_id`    BIGINT UNSIGNED NOT NULL,
    `is_primary`   TINYINT(1) NOT NULL DEFAULT 0,
    `assigned_at`  TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `assigned_by`  BIGINT UNSIGNED NULL,
    UNIQUE KEY `uq_emp_branch` (`employee_id`, `branch_id`),
    INDEX `idx_emp_branches_branch` (`branch_id`),
    CONSTRAINT `fk_emp_branches_emp` FOREIGN KEY (`employee_id`) REFERENCES `employees`(`id`) ON DELETE CASCADE,
    CONSTRAINT `fk_emp_branches_branch` FOREIGN KEY (`branch_id`) REFERENCES `branches`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
",
    'down' => "DROP TABLE IF EXISTS `employee_branches`",
];
