Skip to content

Conversation

@lsmith77
Copy link

@lsmith77 lsmith77 commented Jan 21, 2026

fixes #605
see also zenstackhq/zenstack-docs#555

Summary by CodeRabbit

  • Bug Fixes
    • Improved database feature detection for schema generation: the system now detects and enables relevant preview features for multi-schema support and PostgreSQL extensions when present, ensuring generated schemas align with datasource capabilities and reducing manual configuration.

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

The Prisma schema generator now inspects datasource config for both schemas and extensions and conditionally enables corresponding preview features: multiSchema when schemas are present and postgresqlExtensions when extensions are present, combining them as needed.

Changes

Cohort / File(s) Summary
Prisma Schema Feature Detection
packages/sdk/src/prisma/prisma-schema-generator.ts
Replaces single-feature toggle with datasource-aware detection. Populates previewFeatures with multiSchema if datasource.schemas exists and postgresqlExtensions if datasource.extensions exists; supports enabling both simultaneously while preserving existing generation flow.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 I sniff the schemas, I hop through the fields,
Extensions and scopes in tidy new yields,
I stitch preview flags where configs abide,
Now schemas and extensions both dance side by side. 🥕✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The PR partially addresses issue #605 by enabling the multiSchema preview feature when schemas are detected, but the summary does not indicate preservation of @@Schema() attributes on models, which is also required by the issue. Confirm whether this PR alone fully preserves both datasource.schemas array AND @@Schema() model attributes, or if additional changes are needed in the schema generation logic.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Enable Prisma multiSchema previewFeatures if necessary' accurately describes the main code change, which enables the multiSchema preview feature conditionally based on datasource configuration.
Out of Scope Changes check ✅ Passed The changes are focused on conditional preview feature activation based on datasource configuration, which is directly related to enabling multi-schema support as specified in issue #605.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

@lsmith77
Copy link
Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

@@schema is not preserved in schema.prisma generation

1 participant