CREATE TABLE IF NOT EXISTS video_jobs (
    id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
    public_id CHAR(36) NOT NULL UNIQUE,
    original_name VARCHAR(255) NOT NULL,
    input_path VARCHAR(255) NOT NULL,
    output_path VARCHAR(255) DEFAULT NULL,
    status VARCHAR(24) NOT NULL DEFAULT 'processing',
    error_message TEXT DEFAULT NULL,
    input_size BIGINT UNSIGNED DEFAULT NULL,
    output_size BIGINT UNSIGNED DEFAULT NULL,
    tool_key VARCHAR(40) NOT NULL DEFAULT 'webm_mp4',
    source_format VARCHAR(32) DEFAULT NULL,
    target_format VARCHAR(32) DEFAULT NULL,
    preset_key VARCHAR(40) DEFAULT NULL,
    output_mime VARCHAR(100) DEFAULT NULL,
    download_name VARCHAR(255) DEFAULT NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    completed_at DATETIME DEFAULT NULL,
    INDEX idx_video_jobs_created_at (created_at),
    INDEX idx_video_jobs_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
