nxtgauge-backend-rust/crates/db/migrations/20260415010004_remove_external_links.up.sql
Tracewebstudio Dev 03376b9567 feat: Add database redesign documentation and Phase 1-2 migrations
- Add schema_audit.md documenting current schema issues
- Add target_schema.md with complete target schema design
- Add old_to_new_mapping.md with table mapping
- Add migration_plan.md with phased migration strategy
- Add Phase 1 migrations (core infrastructure):
  - user_sessions table
  - users missing columns
  - departments updates
  - designations updates
  - employees updates
- Add Phase 2 migrations (profile domain - CRITICAL):
  - create user_role_profiles root table
  - backfill user_role_profiles from existing profiles
  - add user_role_profile_id to extension tables
  - remove forbidden external portfolio links
- Add user_role_profile Rust model
- Update photographer model to use user_role_profile_id
2026-04-12 23:21:11 +02:00

31 lines
1.6 KiB
SQL

-- Phase 2.4: Remove forbidden external portfolio links
-- Migration: 20260415010004
-- Per source of truth: NO external portfolio links allowed
-- Remove github_url, portfolio_url from developer_profiles
ALTER TABLE developer_profiles DROP COLUMN IF EXISTS github_url;
ALTER TABLE developer_profiles DROP COLUMN IF EXISTS portfolio_url;
-- Remove reel_url from video_editor_profiles
ALTER TABLE video_editor_profiles DROP COLUMN IF EXISTS reel_url;
-- Remove portfolio_url from graphic_designer_profiles
ALTER TABLE graphic_designer_profiles DROP COLUMN IF EXISTS portfolio_url;
-- Remove portfolio_url from photographer_profiles
ALTER TABLE photographer_profiles DROP COLUMN IF EXISTS portfolio_url;
-- Remove custom_data from all extension tables (preserve as JSONB if needed)
ALTER TABLE photographer_profiles DROP COLUMN IF EXISTS custom_data;
ALTER TABLE tutor_profiles DROP COLUMN IF EXISTS custom_data;
ALTER TABLE makeup_artist_profiles DROP COLUMN IF EXISTS custom_data;
ALTER TABLE developer_profiles DROP COLUMN IF EXISTS custom_data;
ALTER TABLE video_editor_profiles DROP COLUMN IF EXISTS custom_data;
ALTER TABLE graphic_designer_profiles DROP COLUMN IF EXISTS custom_data;
ALTER TABLE social_media_manager_profiles DROP COLUMN IF EXISTS custom_data;
ALTER TABLE fitness_trainer_profiles DROP COLUMN IF EXISTS custom_data;
ALTER TABLE catering_service_profiles DROP COLUMN IF EXISTS custom_data;
ALTER TABLE ugc_content_creator_profiles DROP COLUMN IF EXISTS custom_data;
-- Rename inconsistent columns
ALTER TABLE tutor_profiles RENAME COLUMN subjects_taught TO subjects;