Repository navigation
fix: verify PostgreSQL foreign key trigger enforcement - #528
Conversation
✅ Deploy Preview for prisma-dart canceled.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughPostgreSQL migration catalog checks now reject partitioned tables and foreign keys whose internal constraint triggers are disabled or replica-only. Documentation describes these requirements and clarifies that catalog checks do not scan rows for historical violations. PostgreSQL tests cover these checks and related migration behavior. ChangesPostgreSQL Migration Catalog Validation
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The migration checks and regression tests cover the described trigger and partition safeguards, with no identified merge-blocking risk. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)✨ Finishing Touches🧪 Generate unit tests (beta)
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. A rabbit checks each trigger’s place, Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 730d0b9ce2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Refs #516
PostgreSQL can retain an enforced, validated foreign-key definition after its internal triggers have been disabled. The migration runner previously accepted that catalog and committed history markers even though later writes could violate the relationship.
Check all four ordinary foreign-key triggers, including the referenced parent's actions, inside the existing batched catalog query. Reject disabled and replica-only triggers and reject an active replica session unless the checks are ALWAYS enabled. Preserve the caller's session configuration. Frozen schemas do not describe partitions, so reject partitioned roots and individual partitions instead of incompletely validating their descendant constraints.
Validation: eight live PostgreSQL regression cases failed before the fix. They cover both trigger sides, disabled/replica modes, saved-history drift before pending DDL, active replication role and partition roots/leaves. The corrected runner rolls back new DDL/markers, preserves existing data/history, and resumes after explicit repair. Ordinary and ALWAYS triggers pass; an unchanged two-table history still takes ten statements, with the same three catalog reads per batch. The complete PostgreSQL migration test file and analysis pass.
This verifies current enforcement configuration, not historical PostgreSQL row integrity after privileged bypass. No business-table scan, per-table query or new abstraction is added. Reviewed definitions and fingerprints remain unchanged.
Summary by CodeRabbit