dukcapil/migrations/000035_add_parent_department_id.down.sql
2025-09-20 16:31:22 +07:00

15 lines
469 B
SQL

-- Drop the view
DROP VIEW IF EXISTS department_hierarchy;
-- Drop the functions
DROP FUNCTION IF EXISTS get_department_hierarchy_path(UUID);
DROP FUNCTION IF EXISTS check_department_hierarchy();
-- Drop the trigger
DROP TRIGGER IF EXISTS check_department_hierarchy_trigger ON departments;
-- Drop the index
DROP INDEX IF EXISTS idx_departments_parent_id;
-- Remove the parent_department_id column
ALTER TABLE departments DROP COLUMN IF EXISTS parent_department_id;