backend-stream#958
Open
Securify001 wants to merge 1 commit into
Open
Conversation
Contributor
|
heads up: main's ci was broken (the Backend CI and Backend Docker Image CI jobs) until the fixes in #969 and #974 just landed, so the red backend/docker checks on this pr are almost certainly stale, they ran against the broken main. please rebase to re-test against the now-green main: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Schema & migration: Replaced @@index([streamId, createdAt]) with @@index([streamId, timestamp]) in backend/prisma/schema.prisma.
Added migration backend/prisma/migrations/20260630120000_add_stream_event_stream_id_timestamp_index/migration.sql:
Creates StreamEvent_streamId_timestamp_idx
Drops unused StreamEvent_streamId_createdAt_idx (with IF EXISTS, since it was only in schema drift and never migrated)
Type of Change
Related Issues
Closes #833
Closes #834
Closes #835
Closes #836
Changes Made
The listed controllers already match the new index access pattern:
getStreamEvents — where: { streamId } + orderBy: { timestamp }
getStream include — events: { orderBy: { timestamp: 'desc' } }
getUserEvents — orderBy: { timestamp: 'desc' }
Testing
Test Coverage
Test Steps
All targeted tests pass:
stream.controller.test.ts — 10 passed
user.controller.test.ts — 11 passed
integration/streams.test.ts — 12 passed
npx prisma validate passes. Docker/Postgres is not available here, so EXPLAIN-based index verification was not run locally; the migration SQL follows the same pattern as prior index migrations in this repo.
When you have Postgres available, apply with:
cd backend && npx prisma migrate deployMigration Guide:
Added migration backend/prisma/migrations/20260630120000_add_stream_event_stream_id_timestamp_index/migration.sql:
Creates StreamEvent_streamId_timestamp_idx
Drops unused StreamEvent_streamId_createdAt_idx (with IF EXISTS, since it was only in schema drift and never migrated)
Checklist
Additional Notes