mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user