Fix migrations

This commit is contained in:
Konstantin Wohlwend 2026-01-10 16:05:21 -08:00
parent ad802ca279
commit d01edd390e
2 changed files with 5 additions and 3 deletions

View File

@ -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'),

View File

@ -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;