wulf-pulse/migrations/087_user_queue_preferences.sql
lorentz 672f17b7f9 chore: check in pending work — queue preferences, QBO AR diagnostics, mobile engagement fixes, ops scripts
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
2026-07-18 06:34:57 -04:00

23 lines
1.1 KiB
SQL

-- =============================================================================
-- Per-user queue preferences
-- =============================================================================
-- Lets each user hide specific queues from their own dashboard widgets
-- (notably the Queue posture heatmap). Presence of a row = that user has
-- hidden that queue. Absence = visible.
--
-- Independent of the global company_scope filter — that affects KPI counts
-- for everyone, this only affects what an individual user chooses to see.
-- =============================================================================
CREATE TABLE IF NOT EXISTS user_queue_preferences (
user_id TEXT NOT NULL REFERENCES "user"(id) ON DELETE CASCADE,
queue_id INTEGER NOT NULL REFERENCES queues(value) ON DELETE CASCADE,
hidden_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
PRIMARY KEY (user_id, queue_id)
);
CREATE INDEX IF NOT EXISTS idx_user_queue_preferences_user
ON user_queue_preferences(user_id);
COMMENT ON TABLE user_queue_preferences IS
'Per-user hidden-queue list. Row presence = queue is hidden for that user in dashboard widgets.';