fix: add partial WHERE clause to JourneySegment unique index migration

Without WHERE ("seatId" IS NOT NULL) the index creation fails in
environments that have JourneySegment rows with NULL seatId sharing
the same (scheduleId, departureStationId), which aborts the CI/CD
pipeline before the API server restarts.  Also adds the passenger.
schema prefix to match the DELETE statement above it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Roba Boru
2026-07-19 17:10:57 +03:00
parent a07c9a6014
commit df992eb794

View File

@@ -15,6 +15,7 @@ WHERE id NOT IN (
)
AND "seatId" IS NOT NULL;
-- CreateIndex
-- CreateIndex (partial: only index rows where seatId is not null so NULL rows never collide)
CREATE UNIQUE INDEX IF NOT EXISTS "JourneySegment_scheduleId_seatId_departureStationId_key"
ON "JourneySegment"("scheduleId", "seatId", "departureStationId");
ON passenger."JourneySegment"("scheduleId", "seatId", "departureStationId")
WHERE ("seatId" IS NOT NULL);