CREATE TABLE IF NOT EXISTS jobs (
  id TEXT PRIMARY KEY,
  type TEXT NOT NULL DEFAULT 'encode',
  url TEXT,
  file_path TEXT,
  original_file_name TEXT,
  output_file_name TEXT,
  status TEXT NOT NULL DEFAULT 'pending',
  progress INTEGER DEFAULT 0,
  current_step TEXT,
  resolution TEXT DEFAULT 'all',
  series_name TEXT,
  batch_index INTEGER DEFAULT 0,
  batch_total INTEGER DEFAULT 0,
  file_info TEXT,
  output_files TEXT,
  gdrive_folder_id TEXT,
  gdrive_folder_name TEXT,
  gdrive_file_ids TEXT,
  log TEXT DEFAULT '',
  error TEXT,
  created_at TEXT DEFAULT (datetime('now')),
  updated_at TEXT DEFAULT (datetime('now'))
);
