-- Migration: Add currency to jobs and expand options
-- Description: Adds currency field and expands salary_type and employment_type options

-- Add currency column
ALTER TABLE jobs ADD COLUMN IF NOT EXISTS currency VARCHAR(3) DEFAULT 'BRL';

-- Update salary_type constraint to include more options
ALTER TABLE jobs DROP CONSTRAINT IF EXISTS jobs_salary_type_check;
ALTER TABLE jobs ADD CONSTRAINT jobs_salary_type_check 
    CHECK (salary_type IN ('hourly', 'daily', 'weekly', 'monthly', 'yearly'));

-- Update employment_type constraint to include more options
ALTER TABLE jobs DROP CONSTRAINT IF EXISTS jobs_employment_type_check;
ALTER TABLE jobs ADD CONSTRAINT jobs_employment_type_check 
    CHECK (employment_type IN ('full-time', 'part-time', 'contract', 'temporary', 'training', 'voluntary', 'dispatch', 'permanent'));

-- Add index for currency filtering
CREATE INDEX IF NOT EXISTS idx_jobs_currency ON jobs(currency);

-- Comments
COMMENT ON COLUMN jobs.currency IS 'Currency code (BRL, USD, EUR, GBP, JPY, etc.)';
