Files
fourge-portal/supabase/migrations/20260623140000_add_performance_indexes.sql
T
Krao Hasanee c91e292066 redesign: Layout2 design-system + dashboard/tasks rework + perf
Design system (Layout2):
- Solid token-driven theme (no animated grid); single-source tokens for bg,
  cards (bg/border/radius), popups, fonts (Inter), and full semantic +
  data-viz color palette. Swept ~168 hardcoded colors to tokens.

Dashboard:
- Reflow: To Do + Calendar row (fixed right rail) over Activity / In-Progress /
  Team Performance; CSS height-match (To Do = Calendar); responsive stacking.
- 'Tasks Not Started' -> 'To Do' card with R#/Assigned columns; compact money fmt.

Tasks page:
- Combined tabs into Tasks + Completed with a Status column.
- Column-header sort + filter (Status, R#/new-vs-revision, Project, Task Type,
  Company) via portaled, scrollable FilterDropdown; removed toolbar filters and
  the projects side panel; headers stay visible when empty; renamed to 'Tasks'.

Perf:
- FK/filter index migration; removed redundant client/external scope waterfall
  (rely on RLS); parallel follow-up queries.

Mobile:
- Responsive grids; mobile topbar = hamburger only, blends with bg, proper offset.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 10:08:40 -04:00

33 lines
2.1 KiB
SQL

-- Performance: index foreign-key / filter columns.
-- Postgres does not auto-index FK columns. These back the RLS policy subqueries
-- (task_id IN (… join projects …)) and the app's eq/in filters on these columns.
-- All additive and safe; no behavior change.
create index if not exists tasks_project_id_idx on public.tasks (project_id);
create index if not exists tasks_assigned_to_idx on public.tasks (assigned_to);
create index if not exists tasks_status_idx on public.tasks (status);
create index if not exists tasks_submitted_at_idx on public.tasks (submitted_at desc);
create index if not exists submissions_task_id_idx on public.submissions (task_id);
create index if not exists submissions_submitted_by_idx on public.submissions (submitted_by);
create index if not exists submissions_submitted_at_idx on public.submissions (submitted_at desc);
create index if not exists projects_company_id_idx on public.projects (company_id);
-- deliveries.submission_id already covered by a UNIQUE index.
create index if not exists delivery_files_delivery_id_idx on public.delivery_files (delivery_id);
create index if not exists submission_files_submission_id_idx on public.submission_files (submission_id);
create index if not exists project_members_project_id_idx on public.project_members (project_id);
create index if not exists project_members_profile_id_idx on public.project_members (profile_id);
create index if not exists company_members_profile_id_idx on public.company_members (profile_id);
create index if not exists company_members_company_id_idx on public.company_members (company_id);
create index if not exists activity_log_task_id_idx on public.activity_log (task_id);
create index if not exists activity_log_created_at_idx on public.activity_log (created_at desc);
create index if not exists invoice_items_invoice_id_idx on public.invoice_items (invoice_id);
create index if not exists invoice_items_task_id_idx on public.invoice_items (task_id);
create index if not exists invoices_company_id_idx on public.invoices (company_id);