
-- Fix Companies
ALTER TABLE companies ADD COLUMN IF NOT EXISTS document VARCHAR(100);
ALTER TABLE companies ADD COLUMN IF NOT EXISTS address TEXT;
ALTER TABLE companies ADD COLUMN IF NOT EXISTS region_id INT;
ALTER TABLE companies ADD COLUMN IF NOT EXISTS city_id INT;
ALTER TABLE companies ADD COLUMN IF NOT EXISTS phone VARCHAR(30);
ALTER TABLE companies ADD COLUMN IF NOT EXISTS email VARCHAR(255);
-- website existed
ALTER TABLE companies ADD COLUMN IF NOT EXISTS verified BOOLEAN DEFAULT false;
ALTER TABLE companies ADD COLUMN IF NOT EXISTS active BOOLEAN DEFAULT true;
-- Drop legacy constraints
ALTER TABLE companies DROP CONSTRAINT IF EXISTS companies_type_check;

-- Fix Jobs
ALTER TABLE jobs ADD COLUMN IF NOT EXISTS salary_min DECIMAL(12,2);
ALTER TABLE jobs ADD COLUMN IF NOT EXISTS salary_max DECIMAL(12,2);
ALTER TABLE jobs ADD COLUMN IF NOT EXISTS salary_type VARCHAR(20);
ALTER TABLE jobs ADD COLUMN IF NOT EXISTS employment_type VARCHAR(30);
ALTER TABLE jobs ADD COLUMN IF NOT EXISTS working_hours VARCHAR(100);
-- location existed
ALTER TABLE jobs ADD COLUMN IF NOT EXISTS visa_support BOOLEAN DEFAULT false;
ALTER TABLE jobs ADD COLUMN IF NOT EXISTS language_level VARCHAR(20);
ALTER TABLE jobs ADD COLUMN IF NOT EXISTS region_id INT;
ALTER TABLE jobs ADD COLUMN IF NOT EXISTS city_id INT;
