Skip to main content
Migration: 20260121000000_performance_indexes_phase2.sql
Date: 2026-01-21
Status: Production ✅ | Staging ✅ COMPLETE

Deployment Summary

Production ✅ COMPLETE

  • Status: ✅ Successfully deployed via MCP
  • Date: 2026-01-21
  • Indexes Created: 13 indexes (4 date range, 3 multi-column, 5 sort, 1 search)

Staging ✅ COMPLETE

  • Project ID: bcuftbeczbudndukafbc
  • Status: ✅ Successfully deployed via CLI
  • Date: 2026-01-21
  • Indexes Created: 13 indexes (4 date range, 3 multi-column, 5 sort, 1 search)

Deploy to Staging

Option 2: Using Supabase Dashboard

  1. Navigate to: Supabase project dashboard
  2. Go to: SQL Editor
  3. Copy and paste the SQL from: supabase/migrations/20260121000000_performance_indexes_phase2.sql
  4. Execute the SQL
  5. Verify indexes were created

Option 3: Using Migration Apply Tool

If you have access to staging MCP connection:

Verification Queries

After deploying to staging, run these queries to verify:
Expected Result: 10+ indexes should be listed

Indexes Created

Date Range Queries (4 indexes)

  • idx_rh_schedule_instances_org_date
  • idx_rh_attendance_records_org_schedule
  • idx_hr_leave_requests_org_start_date
  • idx_gr_audits_org_scheduled_date

Multi-Column Filters (3 indexes - conditional)

  • idx_it_tickets_org_site_status (if site_id exists)
  • idx_rh_episodes_org_site_status (if site_id exists)
  • idx_fm_work_orders_org_site_status (if site_id exists)

Sort Optimization (5 indexes)

  • idx_gr_audits_org_created_desc
  • idx_it_tickets_org_created_desc
  • idx_hr_leave_requests_org_created_desc
  • idx_rh_episodes_org_created_desc
  • idx_fm_work_orders_org_created_desc

Search Optimization (1 index)

  • idx_it_tickets_org_subject

Configuration Updated

config.toml updated with correct staging project ID: bcuftbeczbudndukafbc

Next Steps

  1. Deploy to Staging using one of the methods above
  2. Verify indexes using the verification query
  3. Monitor performance after 1 week
  4. Check index usage to ensure indexes are being utilized

Last Updated: 2026-01-21