CREATE DATABASE IF NOT EXISTS pi_tasks;
USE pi_tasks;

CREATE TABLE IF NOT EXISTS task_log (
    log_id INT AUTO_INCREMENT PRIMARY KEY,
    task_name VARCHAR(50) NOT NULL,
    start_time DATETIME NOT NULL,
    pi_status ENUM('PENDING', 'RUNNING', 'FINISHED', 'BROKEN', 'ERROR') NOT NULL DEFAULT 'PENDING',
    pi_duration_seconds INT NULL,
    unity_status ENUM('PENDING', 'RUNNING', 'FINISHED', 'BROKEN', 'ERROR') NOT NULL DEFAULT 'PENDING',
    unity_duration_seconds INT NULL,
    message TEXT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);