<?php
declare(strict_types=1);
return [
    'up' => "CREATE TABLE IF NOT EXISTS `player_disciplines` (
    `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `player_id` BIGINT UNSIGNED NOT NULL,
    `discipline_id` BIGINT UNSIGNED NOT NULL,
    `age_group` VARCHAR(50) NULL,
    `skill_level` VARCHAR(50) NULL,
    `season` VARCHAR(20) NULL COMMENT 'e.g. 2025-2026',
    `status` VARCHAR(20) NOT NULL DEFAULT 'active' COMMENT 'active, inactive, transferred',
    `registered_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX `idx_player_disciplines_player` (`player_id`),
    INDEX `idx_player_disciplines_discipline` (`discipline_id`),
    INDEX `idx_player_disciplines_season` (`season`),
    UNIQUE KEY `uq_player_discipline_season` (`player_id`, `discipline_id`, `season`),
    CONSTRAINT `fk_pd_player` FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE,
    CONSTRAINT `fk_pd_discipline` FOREIGN KEY (`discipline_id`) REFERENCES `sport_disciplines`(`id`) ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
    'down' => "DROP TABLE IF EXISTS `player_disciplines`",
];
