389e8b785c
Full-stack removal of the three retired sections.
Backend
- routes/executive-meetings.ts: deleted /requests* + /tasks* handlers,
REQUEST_ROLES / TASK_VIEW_ROLES / TASK_BROAD_VIEW_ROLES, the three
capability flags from /me, retired imports, and dead schemas
(detailsByType, request*Schema, taskCreateSchema, taskPatchSchema,
dueAtSchema, dateOnly, timeHm). canApprove kept (FontSettings).
- lib/executive-meeting-notify.ts: types collapsed to ['meeting_created'].
Frontend
- pages/executive-meetings.tsx: deleted Requests/Approvals/Tasks
sections, RequestListRow, retired SECTIONS entries, MeRoles type, and
unused icon imports.
- hooks/use-notifications-socket.ts: dropped two retired invalidations.
- locales/{ar,en}.json: removed nav + section + 6 retired type keys.
Schema + DB
- lib/db/src/schema/executive-meetings.ts: tables/relations removed.
- scripts/cleanup-em-requests-tasks.sql: idempotent cleanup — orphan
prefs / notifications / audit rows then DROP TABLE … CASCADE.
Applied to dev DB; `db push` re-synced.
Tests
- Sequential `node --test --test-concurrency=1` → 226/226 pass.
- 3 pre-existing parallel-file pollution failures in the workflow
runner are unrelated to #262 (verified by sequential run).
- Pre-existing tsc warnings at routes L509/625/L1594 untouched.
55 lines
1.8 KiB
PL/PgSQL
55 lines
1.8 KiB
PL/PgSQL
-- #262: Executive Meetings Requests/Approvals/Tasks removal cleanup.
|
|
--
|
|
-- Drops the two retired tables and scrubs orphaned rows from the
|
|
-- surviving Executive Meetings tables that referenced them by string.
|
|
-- Idempotent: safe to re-run. Wraps everything in a single transaction
|
|
-- so a partial failure leaves the DB unchanged.
|
|
--
|
|
-- Run order:
|
|
-- 1) Apply this script to dev / prod databases.
|
|
-- 2) Run `pnpm --filter @workspace/db push` to confirm the Drizzle
|
|
-- schema and the database are in sync (should be a no-op).
|
|
--
|
|
-- Run command (dev):
|
|
-- psql "$DATABASE_URL" -f artifacts/api-server/scripts/cleanup-em-requests-tasks.sql
|
|
|
|
BEGIN;
|
|
|
|
-- 1. Notification preferences rows for retired event types.
|
|
DELETE FROM executive_meeting_notification_prefs
|
|
WHERE notification_type IN (
|
|
'request_submitted',
|
|
'request_approved',
|
|
'request_rejected',
|
|
'request_needs_edit',
|
|
'task_assigned',
|
|
'task_completed'
|
|
);
|
|
|
|
-- 2. Notifications rows for retired event types (executive-meeting domain only).
|
|
DELETE FROM executive_meeting_notifications
|
|
WHERE notification_type IN (
|
|
'request_submitted',
|
|
'request_approved',
|
|
'request_rejected',
|
|
'request_needs_edit',
|
|
'task_assigned',
|
|
'task_completed'
|
|
);
|
|
|
|
-- 3. Global notifications (bell feed) tied to retired request/task events.
|
|
DELETE FROM notifications
|
|
WHERE related_type IN ('executive_meeting_request', 'executive_meeting_task');
|
|
|
|
-- 4. Audit logs that targeted request/task entities.
|
|
DELETE FROM executive_meeting_audit_logs
|
|
WHERE entity_type IN ('request', 'task');
|
|
|
|
-- 5. Drop the retired tables themselves. CASCADE removes any FK indices
|
|
-- that referenced them; nothing in the surviving schema depends on
|
|
-- these two tables.
|
|
DROP TABLE IF EXISTS executive_meeting_tasks CASCADE;
|
|
DROP TABLE IF EXISTS executive_meeting_requests CASCADE;
|
|
|
|
COMMIT;
|