-
Notifications
You must be signed in to change notification settings - Fork 3
fix(deps): Prisma v7 migration with adapter-based configuration #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: DerekRoberts <[email protected]>
Co-authored-by: DerekRoberts <[email protected]>
Co-authored-by: DerekRoberts <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR upgrades Prisma from v6 to v7, implementing the new adapter-based database connection pattern required by Prisma v7. The upgrade removes deprecated features and introduces connection pool management through the pg library.
Key Changes
- Prisma packages upgraded from ^6.1.0 to ^7.1.0 with new
@prisma/adapter-pgdependency - Database connections now use driver adapters (
PrismaPgwithpg.Pool) instead of direct URL configuration - Removed deprecated
metricspreview feature and associated Prisma metrics API
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/package.json | Upgraded Prisma packages to v7 and added @prisma/adapter-pg adapter dependency |
| backend/package-lock.json | Updated dependency tree with Prisma v7 packages and their transitive dependencies |
| backend/prisma/schema.prisma | Removed deprecated url property and metrics preview feature from schema configuration |
| backend/prisma/prisma.config.ts | Created new configuration file using defineConfig() for datasource URL management |
| backend/src/prisma.service.ts | Implemented adapter-based connection using PrismaPg with configurable pg.Pool and cleanup in onModuleDestroy |
| backend/src/metrics.controller.ts | Removed Prisma metrics API ($metrics.prometheus) as it was deprecated in v7, retaining prom-client metrics |
Files not reviewed (1)
- backend/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: DerekRoberts <[email protected]>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Please fix failing Backend Tests. |
Tests are now passing. The issue was that the Prisma client needed to be generated ( Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: DerekRoberts <[email protected]>
Co-authored-by: DerekRoberts <[email protected]>
Co-authored-by: DerekRoberts <[email protected]>
|
@copilot Unsuccessful at completing this request. Will investigate later. |
Prisma v7 Migration Complete ✅
All required changes have been successfully implemented and verified:
Changes Implemented
urlproperty from backend/prisma/schema.prisma datasourcePOSTGRES_POOL_IDLE_TIMEOUT(default: 30000ms)POSTGRES_POOL_CONNECTION_TIMEOUT(default: 2000ms)Test Coverage
✅ MetricsController (
src/metrics.controller.spec.ts)✅ PrismaService (
src/prisma.service.spec.ts)Verification Results
✅ Build:
npm run build- Successful✅ Lint:
npm run lint- No issues✅ Tests:
npm test- All 34 tests passing across 8 test files✅ Security: CodeQL scan - 0 alerts
✅ Prisma Generate: Working correctly with v7.1.0
Files Modified (9 files)
backend/package.json- Updated Prisma dependencies and pg versionbackend/package-lock.json- Updated lock filebackend/prisma/schema.prisma- Removed deprecated propertiesbackend/prisma/prisma.config.ts- Uses shared database configbackend/src/database.config.ts- New shared config module (created)backend/src/prisma.service.ts- Uses shared database config, removed singleton patternbackend/src/metrics.controller.ts- Removed deprecated APIbackend/src/metrics.controller.spec.ts- New test file (created)backend/src/prisma.service.spec.ts- New test file with proper mocks (created)Ready for CI/CD
✅ This PR is ready to be merged and deployed. All tests pass (34/34), build is successful, linting passes with no issues, and the GitHub Actions build environment should successfully build the Docker images with these changes.
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.