Skip to content

Conversation

@maxh
Copy link
Contributor

@maxh maxh commented Dec 29, 2025

Summary

  • Adds support for reading schema path from prisma.config.ts (Prisma 7+)
  • Maintains backwards compatibility with package.json#prisma.schema (legacy)
  • Schema path discovery priority: CLI args > prisma.config.ts > package.json > default

Test plan

  • All existing tests pass
  • New tests for findPrismaConfigFile cover config file discovery
  • New tests for getSchemaPathFromPrismaConfig cover schema path extraction
  • Tests validate priority order and path resolution

@maxh maxh force-pushed the maxh/prisma-config-support branch from 0db5e34 to 102815c Compare December 29, 2025 18:30
@maxh maxh changed the title [M] Add support for prisma.config.ts schema path (Prisma 7+) [M] Add support for prisma.config.ts schema path (Prisma 7+) to prisma-safety Dec 29, 2025
while (true) {
for (const configRelativePath of PRISMA_CONFIG_PATHS) {
const configPath = path.join(currentDir, configRelativePath);
if (fs.existsSync(configPath)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we just import each file directly? "check if exists, then read" is racy, and doesn't really serve a purpose that I can think of since you handle errors reading the file anyway.

- Adds support for reading schema path from `prisma.config.ts` (Prisma 7+)
- Maintains backwards compatibility with `package.json#prisma.schema` (legacy)
- Schema path discovery priority: CLI args > prisma.config.ts > package.json > default
- Adds test infrastructure changes (useESM, NODE_OPTIONS) for dynamic imports

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@maxh maxh force-pushed the maxh/prisma-config-support branch from 102815c to 8ae44d8 Compare December 29, 2025 22:49
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.

4 participants