Files
invoice-master-poc-v2/migrations/009_add_document_category.sql
Yaojia Wang a516de4320 WIP
2026-02-01 00:08:40 +01:00

14 lines
588 B
SQL

-- 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);