diff --git a/apps/backend/prisma/migrations/20260101000002_create_temporary_session_backfill_index/migration.sql b/apps/backend/prisma/migrations/20260101000002_create_temporary_session_backfill_index/migration.sql index 258883405..531d74069 100644 --- a/apps/backend/prisma/migrations/20260101000002_create_temporary_session_backfill_index/migration.sql +++ b/apps/backend/prisma/migrations/20260101000002_create_temporary_session_backfill_index/migration.sql @@ -1,9 +1,10 @@ --- RUN_OUTSIDE_TRANSACTION_SENTINEL +-- SPLIT_STATEMENT_SENTINEL -- SINGLE_STATEMENT_SENTINEL +-- RUN_OUTSIDE_TRANSACTION_SENTINEL -- Create temporary index for session backfill that matches our query exactly -- The existing session index has branchId before userId/sessionId, which breaks index usage when we use COALESCE on branchId CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_event_session_backfill_temp -ON "Event" ( +ON /* SCHEMA_NAME_SENTINEL */."Event" ( (data->>'projectId'), (COALESCE(data->>'branchId', 'main')), (data->>'userId'), diff --git a/apps/backend/prisma/migrations/20260101000004_drop_session_backfill_index/migration.sql b/apps/backend/prisma/migrations/20260101000004_drop_session_backfill_index/migration.sql index f4c7eb7fd..73a5c372d 100644 --- a/apps/backend/prisma/migrations/20260101000004_drop_session_backfill_index/migration.sql +++ b/apps/backend/prisma/migrations/20260101000004_drop_session_backfill_index/migration.sql @@ -1,4 +1,5 @@ --- RUN_OUTSIDE_TRANSACTION_SENTINEL +-- SPLIT_STATEMENT_SENTINEL -- SINGLE_STATEMENT_SENTINEL +-- RUN_OUTSIDE_TRANSACTION_SENTINEL -- Drop the temporary session backfill index DROP INDEX CONCURRENTLY IF EXISTS idx_event_session_backfill_temp;