-- Make display_name / business_name nullable so upserts can work
-- without forcing the name on every call.
-- Add custom_data JSONB to every profession table so all onboarding
-- form fields are preserved even if they don't have a dedicated column.

ALTER TABLE photographer_profiles        ALTER COLUMN display_name   DROP NOT NULL;
ALTER TABLE tutor_profiles               ALTER COLUMN display_name   DROP NOT NULL;
ALTER TABLE makeup_artist_profiles       ALTER COLUMN display_name   DROP NOT NULL;
ALTER TABLE developer_profiles           ALTER COLUMN display_name   DROP NOT NULL;
ALTER TABLE video_editor_profiles        ALTER COLUMN display_name   DROP NOT NULL;
ALTER TABLE graphic_designer_profiles    ALTER COLUMN display_name   DROP NOT NULL;
ALTER TABLE social_media_manager_profiles ALTER COLUMN display_name  DROP NOT NULL;
ALTER TABLE fitness_trainer_profiles     ALTER COLUMN display_name   DROP NOT NULL;
ALTER TABLE catering_service_profiles    ALTER COLUMN business_name  DROP NOT NULL;

ALTER TABLE photographer_profiles         ADD COLUMN IF NOT EXISTS custom_data JSONB;
ALTER TABLE tutor_profiles                ADD COLUMN IF NOT EXISTS custom_data JSONB;
ALTER TABLE makeup_artist_profiles        ADD COLUMN IF NOT EXISTS custom_data JSONB;
ALTER TABLE developer_profiles            ADD COLUMN IF NOT EXISTS custom_data JSONB;
ALTER TABLE video_editor_profiles         ADD COLUMN IF NOT EXISTS custom_data JSONB;
ALTER TABLE graphic_designer_profiles     ADD COLUMN IF NOT EXISTS custom_data JSONB;
ALTER TABLE social_media_manager_profiles ADD COLUMN IF NOT EXISTS custom_data JSONB;
ALTER TABLE fitness_trainer_profiles      ADD COLUMN IF NOT EXISTS custom_data JSONB;
ALTER TABLE catering_service_profiles     ADD COLUMN IF NOT EXISTS custom_data JSONB;
