<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE `sa_booking_participants` (
            `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `booking_id` BIGINT UNSIGNED NOT NULL,
            `player_id` BIGINT UNSIGNED NULL,
            `participant_name` VARCHAR(300) NULL,
            `is_member` TINYINT(1) NOT NULL DEFAULT 0,
            `price_charged` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
            `checked_in_at` TIMESTAMP NULL,
            `checked_out_at` TIMESTAMP NULL,
            `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
            INDEX `idx_sa_bp_booking` (`booking_id`),
            INDEX `idx_sa_bp_player` (`player_id`),
            CONSTRAINT `fk_sa_bp_booking` FOREIGN KEY (`booking_id`) REFERENCES `sa_bookings`(`id`) ON DELETE CASCADE,
            CONSTRAINT `fk_sa_bp_player` FOREIGN KEY (`player_id`) REFERENCES `sa_players`(`id`) ON DELETE SET NULL
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `sa_booking_participants`",
];
