Skip to content

Conversation

@Harish-Naruto
Copy link
Member

@Harish-Naruto Harish-Naruto commented Jan 5, 2026

Summary by CodeRabbit

  • Chores

    • Upgraded Prisma ecosystem to v7.2.0 and bumped dotenv to v17.2.3.
    • Added PostgreSQL client and TypeScript typings for improved DB compatibility.
    • Centralized database configuration and updated Prisma client setup for PostgreSQL.
  • CI

    • Test workflow now exposes DATABASE_URL to support database-backed tests and migrations.
  • Tests

    • Adjusted test imports to align with regenerated Prisma types.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

Warning

Rate limit exceeded

@Harish-Naruto has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 23 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 530cd32 and a386af2.

📒 Files selected for processing (6)
  • src/services/achievement.service.ts
  • src/services/member.service.ts
  • src/services/progress.service.ts
  • src/services/project.service.ts
  • src/services/question.service.ts
  • src/services/topic.service.ts
📝 Walkthrough

Walkthrough

Prisma/tooling upgraded; new prisma.config.ts added; prisma/schema.prisma generator changed and datasource url/directUrl removed; Prisma client reworked to use @prisma/adapter-pg with default export and re-exports; CI exposes DATABASE_URL; test imports updated to new generated submodules.

Changes

Cohort / File(s) Summary
Dependency updates
package.json
Upgraded Prisma tooling: prisma ^6.11.1 → ^7.2.0, added @prisma/adapter-pg ^7.2.0 and @prisma/client ^7.2.0; added pg ^8.16.3 and @types/pg ^8.16.0; dotenv bumped ^17.2.0 → ^17.2.3
Prisma configuration
prisma.config.ts, prisma/schema.prisma
Added prisma.config.ts (loads .env, sets schema & migrations via defineConfig); prisma/schema.prisma generator changed from "prisma-client-js""prisma-client" and datasource url/directUrl lines removed
Prisma client wiring
src/db/client.ts
Replaced previous client import with @prisma/adapter-pg adapter instantiation using DATABASE_URL; PrismaClient constructed with adapter; named prisma export removed, added default export and export * re-export of generated client
Service import updates
src/services/interview.service.ts
Updated Prisma import to default import (import prisma from "../db/client";) — call sites adjusted to new client export
CI workflow
.github/workflows/tests.yml
Test job environment now sets DATABASE_URL from secrets.DATABASE_URL
Test type import updates
tests/Interview.test.ts, tests/Progress.test.ts, tests/Question.test.ts, tests/Topics.test.ts
Adjusted type imports to new generated Prisma submodules: Verdict../src/generated/prisma/enums, CompletedQuestion../src/generated/prisma/client, Question../src/generated/prisma/client, Topic../src/generated/prisma/browser

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • i-am-that-guy
  • callofcode07

Poem

🐇 I hopped through packages, nudged a seed,
Wired adapters so queries proceed.
Env tucked in, schema found its way,
Tests wake up to the database play.
Thump, nibble, ship — a rabbit’s tiny sway.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main objective of the pull request: upgrading Prisma and introducing a new Prisma configuration setup.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Fix all issues with AI Agents 🤖
In @package.json:
- Line 45: The project has a Prisma version mismatch: the "prisma" CLI
dependency was bumped to "^7.2.0" but "@prisma/client" remains at "^6.11.1";
update the "@prisma/client" dependency to match the "prisma" version (e.g., set
"@prisma/client": "^7.2.0") or align both to the same compatible release, then
reinstall dependencies and run "prisma generate" to regenerate the client so the
runtime client matches the CLI.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dcd51d2 and 856c0b0.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • package.json
  • prisma.config.ts
  • prisma/schema.prisma
🔇 Additional comments (3)
package.json (1)

62-62: dotenv ^17.2.3 is a valid, published release on npm. The version is compatible with the project's dependency set, which targets modern Node.js versions (indicated by recent versions of TypeScript, Prisma, and @types/node). No compatibility issues identified.

prisma/schema.prisma (1)

5-5: No issues with the generator provider configuration.

The generator provider "prisma-client" is the correct value for Prisma v7 (it replaces the older "prisma-client-js"). The configuration also includes the required output path on line 6, so the generator is properly set up.

Likely an incorrect or invalid review comment.

prisma.config.ts (1)

1-17: Fix import statement formatting.

Line 3: Add a space after the comma in the import destructuring:

import { defineConfig, env } from "prisma/config";

The prisma.config.ts with defineConfig from "prisma/config" is the correct Prisma 7 configuration pattern. However, you can simplify the environment loading by using import 'dotenv/config' instead of the dotenv.config() call, which aligns with Prisma 7 documentation practices.

Likely an incorrect or invalid review comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Fix all issues with AI Agents 🤖
In @tests/Progress.test.ts:
- Line 7: The test imports CompletedQuestion from the enums module but
CompletedQuestion is a Prisma model type, not an enum; update the import in
Progress.test.ts to import the CompletedQuestion type from the generated Prisma
client/module that exports model types (the same place other tests get model
types), replacing the incorrect "../src/generated/prisma/enums" import with the
correct generated prisma client export for CompletedQuestion (search the
generated prisma exports if needed to find the exact module name).
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 093d5b0 and f0a3322.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • package.json
  • tests/Interview.test.ts
  • tests/Progress.test.ts
  • tests/Question.test.ts
  • tests/Topics.test.ts
✅ Files skipped from review due to trivial changes (1)
  • tests/Question.test.ts
🧰 Additional context used
🪛 GitHub Actions: Run Tests
tests/Progress.test.ts

[error] 7-7: Module '../src/generated/prisma/enums' has no exported member 'CompletedQuestion'.

🔇 Additional comments (4)
tests/Interview.test.ts (1)

4-4: LGTM! Correct enum import path.

The Verdict enum is correctly imported from the enums module, which aligns with the new Prisma 7.x generated code structure. The usage throughout the test file confirms this is an enum type (e.g., Verdict.Selected).

package.json (2)

59-59: PostgreSQL package versions are current and compatible.

The pg@^8.16.3 and @types/pg@^8.16.0 versions are up-to-date and properly aligned for compatibility with the Prisma PostgreSQL adapter. No action needed.


45-45: Prisma 7.2.0 alignment is correct and properly integrated.

The version alignment across prisma, @prisma/client, and @prisma/adapter-pg (all ^7.2.0) is complete and matches the existing v7 configuration in prisma.config.ts. The datasource URL has been correctly moved to the config file per v7 requirements, and the schema is properly configured. No blocking issues with the package.json updates.

tests/Topics.test.ts (1)

9-9: Fix the Topic import path.

The import path ../src/generated/prisma/browser is incorrect. Based on the pattern used in other test files (e.g., Question.test.ts imports from ../src/generated/prisma/client), model types should import from the /client submodule:

import { Topic } from "../src/generated/prisma/client";

Likely an incorrect or invalid review comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Fix all issues with AI Agents 🤖
In @src/db/client.ts:
- Around line 5-7: The code instantiates PrismaPg with process.env.DATABASE_URL
without validating it, so add a guard to check that DATABASE_URL is present and
non-empty before creating the adapter (e.g., throw a clear error or exit with a
descriptive message if missing/invalid). Modify the initialization surrounding
PrismaPg and the adapter constant (the PrismaPg constructor call and the adapter
variable) to read DATABASE_URL into a local const, validate it (non-empty string
and optionally a basic URI check), and only pass the validated value into new
PrismaPg; if validation fails, surface a clear error referencing DATABASE_URL.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f0a3322 and 530cd32.

📒 Files selected for processing (3)
  • src/db/client.ts
  • src/services/interview.service.ts
  • tests/Progress.test.ts
🔇 Additional comments (4)
src/services/interview.service.ts (1)

1-2: LGTM! Import updated to match new default export.

The import change correctly aligns with the new default export of prisma from src/db/client.ts. The business logic remains unchanged.

tests/Progress.test.ts (1)

7-7: LGTM! Import path corrected to fix pipeline failure.

The import path has been updated to correctly reference the client module, resolving the previous critical error where CompletedQuestion (a Prisma model type) was incorrectly imported from the enums module.

src/db/client.ts (2)

9-11: LGTM! Client instantiation follows adapter pattern.

The PrismaClient instantiation with the adapter and default export pattern is correct and aligns with the adapter-based Prisma setup.


1-3: Imports and adapter setup are correct and compatible.

The @prisma/adapter-pg (^7.2.0) and @prisma/client (^7.2.0) versions are compatible. The adapter is properly instantiated with the required connectionString option from the environment variable, and the PrismaClient is correctly configured to use the adapter. No changes needed.

Comment on lines +5 to +7
const adapter = new PrismaPg({
connectionString: process.env.DATABASE_URL,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add validation for DATABASE_URL environment variable.

The DATABASE_URL environment variable is used without validation. If it's undefined or invalid, the adapter initialization will fail at runtime, potentially with unclear error messages.

🔎 Proposed fix to add validation
+if (!process.env.DATABASE_URL) {
+  throw new Error("DATABASE_URL environment variable is not set");
+}
+
 const adapter = new PrismaPg({
   connectionString: process.env.DATABASE_URL,
 });

Alternatively, use a more defensive approach with a type assertion:

 const adapter = new PrismaPg({
-  connectionString: process.env.DATABASE_URL,
+  connectionString: process.env.DATABASE_URL as string,
 });
+
+if (!process.env.DATABASE_URL) {
+  throw new Error("DATABASE_URL environment variable is not set");
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const adapter = new PrismaPg({
connectionString: process.env.DATABASE_URL,
});
if (!process.env.DATABASE_URL) {
throw new Error("DATABASE_URL environment variable is not set");
}
const adapter = new PrismaPg({
connectionString: process.env.DATABASE_URL,
});
🤖 Prompt for AI Agents
In @src/db/client.ts around lines 5-7, The code instantiates PrismaPg with
process.env.DATABASE_URL without validating it, so add a guard to check that
DATABASE_URL is present and non-empty before creating the adapter (e.g., throw a
clear error or exit with a descriptive message if missing/invalid). Modify the
initialization surrounding PrismaPg and the adapter constant (the PrismaPg
constructor call and the adapter variable) to read DATABASE_URL into a local
const, validate it (non-empty string and optionally a basic URI check), and only
pass the validated value into new PrismaPg; if validation fails, surface a clear
error referencing DATABASE_URL.

@Sherin-2711 Sherin-2711 merged commit 3666d40 into main Jan 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants