-- Drop indexes
DROP INDEX IF EXISTS idx_sessions_expires_at;
DROP INDEX IF EXISTS idx_sessions_user_id;
DROP INDEX IF EXISTS idx_sessions_session_id;
DROP INDEX IF EXISTS idx_runners_last_heartbeat;
DROP INDEX IF EXISTS idx_task_steps_task_id;
DROP INDEX IF EXISTS idx_task_logs_runner_id;
DROP INDEX IF EXISTS idx_task_logs_task_id_id;
DROP INDEX IF EXISTS idx_task_logs_task_id_created_at;
DROP INDEX IF EXISTS idx_runners_api_key_id;
DROP INDEX IF EXISTS idx_runner_api_keys_created_by;
DROP INDEX IF EXISTS idx_runner_api_keys_active;
DROP INDEX IF EXISTS idx_runner_api_keys_prefix;
DROP INDEX IF EXISTS idx_job_files_job_id;
DROP INDEX IF EXISTS idx_tasks_started_at;
DROP INDEX IF EXISTS idx_tasks_job_status;
DROP INDEX IF EXISTS idx_tasks_status;
DROP INDEX IF EXISTS idx_tasks_runner_id;
DROP INDEX IF EXISTS idx_tasks_job_id;
DROP INDEX IF EXISTS idx_jobs_user_status_created;
DROP INDEX IF EXISTS idx_jobs_status;
DROP INDEX IF EXISTS idx_jobs_user_id;

-- Drop tables (order matters due to foreign keys)
DROP TABLE IF EXISTS sessions;
DROP TABLE IF EXISTS settings;
DROP TABLE IF EXISTS task_steps;
DROP TABLE IF EXISTS task_logs;
DROP TABLE IF EXISTS manager_secrets;
DROP TABLE IF EXISTS job_files;
DROP TABLE IF EXISTS tasks;
DROP TABLE IF EXISTS runners;
DROP TABLE IF EXISTS jobs;
DROP TABLE IF EXISTS runner_api_keys;
DROP TABLE IF EXISTS users;

