<?php
declare(strict_types=1);

return [
    'up' => "
CREATE TABLE IF NOT EXISTS pool_hour_plans (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    monthly_plan_id INT UNSIGNED NOT NULL,
    plan_date DATE NOT NULL,
    hour_slot TIME NOT NULL,
    period VARCHAR(10) NOT NULL DEFAULT 'day',
    grid_snapshot_json JSON NOT NULL,
    notes TEXT NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NULL,
    UNIQUE KEY uk_plan_date_hour (monthly_plan_id, plan_date, hour_slot),
    KEY idx_plan_date (plan_date)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
    'down' => "DROP TABLE IF EXISTS pool_hour_plans",
];
