<?php
declare(strict_types=1);

return [
    'up' => "
CREATE TABLE IF NOT EXISTS coach_tokens (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    coach_id INT UNSIGNED NOT NULL,
    token VARCHAR(64) NOT NULL,
    name VARCHAR(100) NOT NULL DEFAULT 'portal',
    last_used_at DATETIME NULL,
    expires_at DATETIME NULL,
    is_revoked TINYINT(1) NOT NULL DEFAULT 0,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    UNIQUE KEY uk_coach_token (token),
    KEY idx_coach_id (coach_id),
    KEY idx_expires (expires_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
    'down' => "DROP TABLE IF EXISTS coach_tokens",
];
