-- Issue Tracker Database Migration
-- Creates the issue_tracker table for reporting and tracking system anomalies
-- Does NOT modify any existing tables

CREATE TABLE IF NOT EXISTS issue_tracker (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  title TEXT NOT NULL,
  category TEXT NOT NULL DEFAULT 'Other',
  severity TEXT NOT NULL DEFAULT 'Low',
  status TEXT NOT NULL DEFAULT 'Open',
  description TEXT,
  steps_to_reproduce TEXT,
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
  updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX IF NOT EXISTS idx_issue_tracker_status ON issue_tracker(status);
CREATE INDEX IF NOT EXISTS idx_issue_tracker_severity ON issue_tracker(severity);
CREATE INDEX IF NOT EXISTS idx_issue_tracker_created ON issue_tracker(created_at);
CREATE INDEX IF NOT EXISTS idx_issue_tracker_category ON issue_tracker(category);
