-- ---------------------------------------------------------------------------
-- Factory-New-Prod — Tokens démo (lien email → page /demo/TOKEN)
-- MariaDB 10.11 | utf8mb4_unicode_ci
-- ---------------------------------------------------------------------------

SET NAMES utf8mb4;

CREATE TABLE IF NOT EXISTS `demo_tokens` (
    `id` INT NOT NULL AUTO_INCREMENT,
    `email` VARCHAR(255) NOT NULL,
    `token` VARCHAR(32) NOT NULL,
    `expires_at` TIMESTAMP NOT NULL,
    `used_at` TIMESTAMP NULL DEFAULT NULL,
    `created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `uq_demo_tokens_token` (`token`),
    KEY `idx_demo_tokens_token` (`token`),
    KEY `idx_demo_tokens_expires_at` (`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
