<?php
declare(strict_types=1);

return [
    'up' => "
CREATE TABLE IF NOT EXISTS player_tokens (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    player_id INT UNSIGNED NOT NULL,
    token VARCHAR(64) NOT NULL,
    name VARCHAR(100) NOT NULL DEFAULT 'mobile',
    device_info VARCHAR(255) NULL,
    push_token VARCHAR(500) NULL,
    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_player_token (token),
    KEY idx_player_id (player_id),
    KEY idx_expires (expires_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
    'down' => "DROP TABLE IF EXISTS player_tokens",
];
