Bundles several in-progress efforts that were sitting uncommitted: - User queue-preferences (migration 087, API route, popover component) - QBO invoice soft-delete (migration 088) and AR diagnostics route - Dashboard/mobile engagement route and page adjustments - Docker Compose log-rotation config - One-off ticket/RMM investigation scripts (scripts/) - Planning docs: phase verification/pattern notes, mobile shell design spec - .gitignore: exclude local scratch financial/inventory data and Claude Code worktree/local-settings runtime state (never meant for version control) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W6RuWdiUiXrPK6FLBHjtpY
17 lines
858 B
SQL
17 lines
858 B
SQL
-- Soft-delete support for qbo_invoices.
|
|
--
|
|
-- QBO's Invoice query endpoint only returns rows that still exist in QBO.
|
|
-- When an invoice is voided or deleted in QBO, it simply stops appearing in
|
|
-- responses — there is no "deleted" flag we can subscribe to. Without a
|
|
-- tombstone pass these orphan rows linger in Pulse forever and keep
|
|
-- inflating Total A/R (see the TNT Pizza incident, 2026-05-15).
|
|
--
|
|
-- A full QBO sync now compares the set of returned invoice IDs against
|
|
-- what Pulse has on file and flips is_deleted = true for any row the
|
|
-- query no longer returns. Finance queries filter on is_deleted = false.
|
|
|
|
ALTER TABLE qbo_invoices
|
|
ADD COLUMN IF NOT EXISTS is_deleted BOOLEAN NOT NULL DEFAULT false,
|
|
ADD COLUMN IF NOT EXISTS deleted_at TIMESTAMPTZ;
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_qbo_invoices_is_deleted ON qbo_invoices(is_deleted);
|