SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS experiment_closing_assessments (
 id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
 workspace_id BIGINT UNSIGNED NOT NULL,
 experiment_id BIGINT UNSIGNED NOT NULL,
 recommendation ENUM('continue_collecting','inconclusive','eligible_for_decision') NOT NULL,
 assessment_snapshot LONGTEXT NOT NULL,
 created_by BIGINT UNSIGNED NULL,
 created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
 INDEX idx_eca_ws_time(workspace_id,created_at),
 INDEX idx_eca_exp_time(experiment_id,created_at),
 CONSTRAINT fk_eca_workspace FOREIGN KEY(workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE,
 CONSTRAINT fk_eca_experiment FOREIGN KEY(experiment_id) REFERENCES ab_experiments(id) ON DELETE CASCADE,
 CONSTRAINT fk_eca_user FOREIGN KEY(created_by) REFERENCES users(id) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
