<?php
declare(strict_types=1);

return [
    'up' => "
        CREATE TABLE IF NOT EXISTS `archive_snapshots` (
            `id`                BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
            `entity_type`       VARCHAR(100) NOT NULL,
            `entity_id`         BIGINT UNSIGNED NOT NULL,
            `membership_number` VARCHAR(20) NULL,
            `snapshot_reason`   VARCHAR(50) NOT NULL,
            `full_data_json`    JSON NOT NULL,
            `related_data_json` JSON NULL,
            `snapshot_taken_by` BIGINT UNSIGNED NULL,
            `snapshot_taken_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
            `notes`             TEXT NULL,
            INDEX `idx_archive_entity` (`entity_type`, `entity_id`),
            INDEX `idx_archive_membership` (`membership_number`),
            INDEX `idx_archive_date` (`snapshot_taken_at`),
            INDEX `idx_archive_reason` (`snapshot_reason`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    ",
    'down' => "DROP TABLE IF EXISTS `archive_snapshots`",
];