<?php
declare(strict_types=1);

return [
    'up' => "CREATE TABLE IF NOT EXISTS `makeup_credits` (
    `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `player_id` BIGINT UNSIGNED NOT NULL,
    `enrollment_id` BIGINT UNSIGNED NOT NULL,
    `missed_session_id` BIGINT UNSIGNED NOT NULL,
    `used_session_id` BIGINT UNSIGNED NULL,
    `status` VARCHAR(20) NOT NULL DEFAULT 'available' COMMENT 'available, used, expired',
    `expires_at` DATE NULL,
    `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    INDEX `idx_mc_player` (`player_id`),
    INDEX `idx_mc_status` (`status`),
    CONSTRAINT `fk_mc_player` FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE,
    CONSTRAINT `fk_mc_missed_session` FOREIGN KEY (`missed_session_id`) REFERENCES `training_sessions`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
    'down' => "DROP TABLE IF EXISTS `makeup_credits`",
];
