From 9e84a7228e1c43f7e5de089fe549859a38f66b57 Mon Sep 17 00:00:00 2001 From: manoahLinks Date: Fri, 29 May 2026 18:44:17 +0100 Subject: [PATCH 1/2] fix(backend): reconcile duplicate pause-state migrations (#526) Two migrations added the same isPaused/pausedAt/totalPausedDuration columns to Stream, so a fresh `prisma migrate deploy` failed with `column "isPaused" already exists` on the second one. - Keep 20260428000000_add_pause_state_fields as the single source of truth for the pause-state columns. - Strip the redundant ADD COLUMNs from 20260428161500_add_stream_pause_fields, leaving only the Stream_isPaused_idx index (now CREATE INDEX IF NOT EXISTS). - Rename 20260428000000_add_stream_event_unique_constraint to 20260428000001_* so the two same-prefix migrations order deterministically. --- .../migration.sql | 0 .../migration.sql | 11 ++++++----- 2 files changed, 6 insertions(+), 5 deletions(-) rename backend/prisma/migrations/{20260428000000_add_stream_event_unique_constraint => 20260428000001_add_stream_event_unique_constraint}/migration.sql (100%) diff --git a/backend/prisma/migrations/20260428000000_add_stream_event_unique_constraint/migration.sql b/backend/prisma/migrations/20260428000001_add_stream_event_unique_constraint/migration.sql similarity index 100% rename from backend/prisma/migrations/20260428000000_add_stream_event_unique_constraint/migration.sql rename to backend/prisma/migrations/20260428000001_add_stream_event_unique_constraint/migration.sql diff --git a/backend/prisma/migrations/20260428161500_add_stream_pause_fields/migration.sql b/backend/prisma/migrations/20260428161500_add_stream_pause_fields/migration.sql index ca29c456..596bfc87 100644 --- a/backend/prisma/migrations/20260428161500_add_stream_pause_fields/migration.sql +++ b/backend/prisma/migrations/20260428161500_add_stream_pause_fields/migration.sql @@ -1,7 +1,8 @@ --- AlterTable -ALTER TABLE "Stream" ADD COLUMN "isPaused" BOOLEAN NOT NULL DEFAULT false; -ALTER TABLE "Stream" ADD COLUMN "pausedAt" INTEGER; -ALTER TABLE "Stream" ADD COLUMN "totalPausedDuration" INTEGER NOT NULL DEFAULT 0; +-- The pause-state columns (isPaused, pausedAt, totalPausedDuration) are added by +-- the earlier migration `20260428000000_add_pause_state_fields`, which is the +-- single source of truth for them. This migration only adds the index, so that a +-- fresh `prisma migrate deploy` no longer fails with +-- `column "isPaused" of relation "Stream" already exists`. -- CreateIndex -CREATE INDEX "Stream_isPaused_idx" ON "Stream"("isPaused"); +CREATE INDEX IF NOT EXISTS "Stream_isPaused_idx" ON "Stream"("isPaused"); From 68de0da49806e5256e9e28157de0c3ddc9ba490c Mon Sep 17 00:00:00 2001 From: manoahLinks Date: Fri, 29 May 2026 20:54:13 +0100 Subject: [PATCH 2/2] test(backend): document duplicate-event-guard mocks to keep CI green The indexer integration suite failed to load when the worker's duplicate-event guard (findUnique/upsert on streamEvent) had no matching mock methods. Add a comment so these mock entries aren't dropped in future edits and re-break the Backend CI job. Closes #527 Co-Authored-By: Claude Opus 4.8 (1M context) --- backend/src/__tests__/integration/streams.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/src/__tests__/integration/streams.test.ts b/backend/src/__tests__/integration/streams.test.ts index 7bc157b6..f26cfd6d 100644 --- a/backend/src/__tests__/integration/streams.test.ts +++ b/backend/src/__tests__/integration/streams.test.ts @@ -20,6 +20,10 @@ const { mockPrisma, mockSseService } = vi.hoisted(() => ({ }, streamEvent: { create: vi.fn(), + // `upsert` + `findUnique` back the worker's duplicate-event guard + // (soroban-event-worker.ts handleStreamCreated/handleStreamCancelled, + // ~L360/L558). Don't remove them or the indexer tests fail to load + // with "is not a function" — this regressed Backend CI in #527. upsert: vi.fn(), findUnique: vi.fn().mockResolvedValue(null), findMany: vi.fn().mockResolvedValue([]),