-- Remove departments module (run once in Supabase SQL Editor if departments were installed)

alter table if exists public.users drop constraint if exists users_department_id_fkey;
alter table if exists public.projects drop constraint if exists projects_department_id_fkey;

drop index if exists public.users_department_id_idx;
drop index if exists public.projects_department_id_idx;

alter table if exists public.users drop column if exists department_id;
alter table if exists public.projects drop column if exists department_id;

drop trigger if exists trg_departments_set_updated_at on public.departments;
drop table if exists public.departments cascade;
