-- Fix support_requests table by adding missing columns
-- Run this script in your PostgreSQL database

-- Add admin_response column
ALTER TABLE support_requests ADD COLUMN IF NOT EXISTS admin_response TEXT;

-- Add assigned_to column (if not exists)
ALTER TABLE support_requests ADD COLUMN IF NOT EXISTS assigned_to UUID REFERENCES users(id) ON DELETE SET NULL;

-- Add response column (if not exists)
ALTER TABLE support_requests ADD COLUMN IF NOT EXISTS response TEXT;

-- Add resolved_at column (if not exists)
ALTER TABLE support_requests ADD COLUMN IF NOT EXISTS resolved_at TIMESTAMP;

-- Add resolved_by column (if not exists)
ALTER TABLE support_requests ADD COLUMN IF NOT EXISTS resolved_by UUID REFERENCES users(id) ON DELETE SET NULL;

-- Verify the table structure
SELECT column_name, data_type, is_nullable 
FROM information_schema.columns 
WHERE table_name = 'support_requests' 
ORDER BY ordinal_position; 