ALTER TABLE permissions
    ADD COLUMN IF NOT EXISTS tenant_id INTEGER;
ALTER TABLE permissions
    ADD COLUMN IF NOT EXISTS branch_id INTEGER;
ALTER TABLE permissions
    ADD COLUMN IF NOT EXISTS department_id INTEGER;
ALTER TABLE permissions
    ADD COLUMN IF NOT EXISTS district_id INTEGER;

CREATE INDEX IF NOT EXISTS permissions_tenant_idx ON permissions(tenant_id);
CREATE INDEX IF NOT EXISTS permissions_branch_idx ON permissions(branch_id);
CREATE INDEX IF NOT EXISTS permissions_department_idx ON permissions(department_id);
CREATE INDEX IF NOT EXISTS permissions_district_idx ON permissions(district_id);
