-- Migration: Add role column to sales_users table
-- Run this SQL to add the role column for authorization

-- Add role column if it doesn't exist
ALTER TABLE sales_users 
ADD COLUMN IF NOT EXISTS role VARCHAR(50) DEFAULT 'agent' NOT NULL;

-- Update existing users to have 'agent' role if they don't have one
UPDATE sales_users SET role = 'agent' WHERE role IS NULL OR role = '';

-- Optional: Set a specific user as administrator (replace 'admin_username' with actual username)
-- UPDATE sales_users SET role = 'administrator' WHERE username = 'admin_username';
