-- Add category column to admin_documents table
-- Allows categorizing documents for training different models (e.g., invoice, letter, receipt)

ALTER TABLE admin_documents ADD COLUMN IF NOT EXISTS category VARCHAR(100) DEFAULT 'invoice';

-- Update existing NULL values to default
UPDATE admin_documents SET category = 'invoice' WHERE category IS NULL;

-- Make it NOT NULL after setting defaults
ALTER TABLE admin_documents ALTER COLUMN category SET NOT NULL;

-- Create index for category filtering
CREATE INDEX IF NOT EXISTS idx_admin_documents_category ON admin_documents(category);
