- zones: add active column (migration 20260713000005) - sites/zones API: PATCH (toggle active) + DELETE (blocked when incidents reference it) - trucks API: PATCH + DELETE with same pattern - admin page: select active for sites + zones - site-zone-manager + truck-manager: deactivate toggle + delete button per row with busyId - incidents API: reject reports on deactivated zone/site; wrap handler in top-level try-catch so unhandled errors return JSON (not HTML) - report-form: parse JSON separately so HTTP status code surfaces instead of generic "Something went wrong" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CPf5Rc8QPx6V8KLEEgfKEQ
5 lines
328 B
SQL
5 lines
328 B
SQL
-- Add soft-delete support to zones (sites and trucks already have this column).
|
|
-- Leave zones_read as USING (true) so deactivated zones still render on historical incidents.
|
|
-- Deactivation is enforced for new reports in the create-incident API, not via RLS.
|
|
ALTER TABLE zones ADD COLUMN active BOOLEAN NOT NULL DEFAULT true;
|