nxtgauge-backend-rust/crates/db/migrations/20260415000003_update_departments.down.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

11 lines
562 B
SQL

-- Rollback: Remove added columns from departments
ALTER TABLE departments DROP COLUMN IF EXISTS code;
ALTER TABLE departments DROP COLUMN IF EXISTS description;
ALTER TABLE departments DROP COLUMN IF EXISTS department_head;
ALTER TABLE departments DROP COLUMN IF EXISTS department_email;
ALTER TABLE departments DROP COLUMN IF EXISTS visibility;
ALTER TABLE departments DROP COLUMN IF EXISTS transfers_enabled;
ALTER TABLE departments DROP COLUMN IF EXISTS updated_at;
DROP INDEX IF EXISTS idx_departments_code;
DROP INDEX IF EXISTS idx_departments_is_active;