<?php
declare(strict_types=1);

return [
    'up' => "CREATE TABLE `sa_pool_zone_template_runs` (
    `id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    `template_id` BIGINT UNSIGNED NOT NULL,
    `date_from` DATE NOT NULL,
    `date_to` DATE NOT NULL,
    `generated_count` INT UNSIGNED NOT NULL DEFAULT 0,
    `skipped_count` INT UNSIGNED NOT NULL DEFAULT 0,
    `status` VARCHAR(20) NOT NULL DEFAULT 'completed' COMMENT 'completed, rolled_back',
    `rolled_back_at` TIMESTAMP NULL,
    `rolled_back_by` BIGINT UNSIGNED NULL,
    `created_by` BIGINT UNSIGNED NULL,
    `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    INDEX `idx_sa_pztr_template` (`template_id`),
    CONSTRAINT `fk_sa_pztr_template` FOREIGN KEY (`template_id`) REFERENCES `sa_pool_zone_templates`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;",
    'down' => "DROP TABLE IF EXISTS `sa_pool_zone_template_runs`;",
];
