You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(sdk): omit updatedAt ignore from Prisma schemas - #2931
@updatedAt(ignore: [views]) is supported by ZModel, but its ignore argument reaches the generated Prisma schema and causes P1012 during migrations or db push.
Filter that argument at the Prisma output boundary. The timestamp attribute and ZenStack's TypeScript metadata remain intact. The regression now lives in the existing CLI Prisma-schema generator suite and covers a populated ignore list, an empty list, plain @updatedAt, and neighboring @default/@map attributes.
pnpm --filter @zenstackhq/sdk build && pnpm --filter @zenstackhq/cli test test/prisma-schema-gen.test.ts
The focused regression, related Prisma-generator/CLI tests, workspace lint, owning build/typechecks, and SQLite CLI migration/push probes pass. Full CLI and regression suites have the same 78 and 251 failed tests on an independently installed base checkout with matching Node/pnpm/dependency versions, including TypeScript resolution, native SQLite bindings, and Prisma command failures. The PostgreSQL/MySQL test matrix and ORM timestamp-update behavior were not validated.
Reviewing files that changed from the base of the PR and between ff8a2e4 and 8484a75.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The Prisma schema generator now omits the ZenStack-only ignore argument from generated @updatedAt attributes. A regression test checks the generated output for non-empty, empty, and absent ignore arguments.
Changes: UpdatedAt Argument Filtering
Layer / File(s)
Summary
Filter and verify @updatedAt arguments packages/sdk/src/prisma/prisma-schema-generator.ts, packages/cli/test/prisma-schema-gen.test.ts
The generator filters resolved ignore arguments from @updatedAt. The test checks that other attributes remain and that @updatedAt() is generated when ignore is non-empty, empty, or absent.
The change stops the ZenStack-only ignore argument from reaching the generated Prisma schema, which should fix the P1012 validation error in migrate and db push. The change is small and covered by a focused test, so merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(sdk): omit updatedAt ignore from Prisma schemas" matches the main change. The SDK's Prisma schema generator now drops the ZenStack-only ignore argument from @updatedAt in the genera…
Linked Issues check
Issue #2930 requires that the generated Prisma schema omit the ZenStack-only ignore argument from @updatedAt. The TS schema must keep it. At the reviewed head, makeFieldAttribute in packages/sdk…
Out of Scope Changes check
The whole-PR diff against the merge base changes the Prisma generator source (a single filter on ignore for @updatedAt, about +3/-1 lines) and adds regression tests for #2930. The regression test …
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check
Explanation
The title "fix(sdk): omit updatedAt ignore from Prisma schemas" matches the main change. The SDK's Prisma schema generator now drops the ZenStack-only ignore argument from @updatedAt in the generated Prisma schema, and a regression test covers this. The title names the affected package, the behavior, and the target output. It is specific and not vague.
Full details: Linked Issues check
Explanation
Issue #2930 requires that the generated Prisma schema omit the ZenStack-only ignore argument from @updatedAt. The TS schema must keep it. At the reviewed head, makeFieldAttribute in packages/sdk/src/prisma/prisma-schema-generator.ts filters out args where attrName === '@updatedAt' && arg.$resolvedParam?.name === 'ignore' before calling makeAttributeArg. Other args, including @default and @map on neighboring fields, follow the unchanged path. The TS schema generator and runtime are not changed by this PR, so ignore metadata stays intact. Regression coverage (populated list, empty list, plain @updatedAt, neighboring @default/@map) is present in the PR. The author reports the focused regression and SQLite migrate/push probes pass. Limits: I did not run the tests. For an empty or plain @updatedAt, the test expectation reportedly renders @updatedAt() rather than the bare @updatedAt named in the issue. This is a textual difference that does not change the ignore-list behavior. PostgreSQL/MySQL validation and ORM timestamp-update behavior were not validated by the author. Issue #2379 (fields) is separate work and is not required here.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against the merge base changes the Prisma generator source (a single filter on ignore for @updatedAt, about +3/-1 lines) and adds regression tests for #2930. The regression test covers the populated list, empty list, plain @updatedAt, and neighboring @default/@map cases, which are the issue's scenarios. The PR description is documentation only. No unrelated files or behavior changes were identified in the reviewed summary. The reviewed head source confirms the filter is the only change in makeFieldAttribute. The diff tool did not return a text diff in this review, so the change scope rests on the summary and the head file read.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Reviewing files that changed from the base of the PR and between cc4c6f6 and ff8a2e4.
Files selected for processing: 1
packages/cli/test/prisma-schema-gen.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
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
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.
@updatedAt(ignore: [views])is supported by ZModel, but itsignoreargument reaches the generated Prisma schema and causes P1012 during migrations ordb push.Filter that argument at the Prisma output boundary. The timestamp attribute and ZenStack's TypeScript metadata remain intact. The regression now lives in the existing CLI Prisma-schema generator suite and covers a populated ignore list, an empty list, plain
@updatedAt, and neighboring@default/@mapattributes.The focused regression, related Prisma-generator/CLI tests, workspace lint, owning build/typechecks, and SQLite CLI migration/push probes pass. Full CLI and regression suites have the same 78 and 251 failed tests on an independently installed base checkout with matching Node/pnpm/dependency versions, including TypeScript resolution, native SQLite bindings, and Prisma command failures. The PostgreSQL/MySQL test matrix and ORM timestamp-update behavior were not validated.
Fixes #2930.
Summary by CodeRabbit
ignorearguments from@updatedAtattributes while preserving other attributes.