-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add body_payload parameter to insert_unsent_notification_to_history #1740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…tory - Add p_body_payload jsonb parameter to stored procedure - Write to body_payload column on INSERT and UPDATE - Keep p_body for backward compatibility
BenchstatBase: |
WalkthroughThe Changes
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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. Comment |
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
views/021_notification.sql (1)
43-56: Drop the previous full signature to avoid callers hitting the old overload.Adding a new optional parameter creates a new signature; if the old signature remains, calls with the previous argument list will still resolve to the old function and never populate
body_payload. Explicitly drop the prior full signature (not just the 5‑arg one) so legacy calls route to the new function with the default value.✅ Suggested fix
-- Ensure the previous function is cleaned up. DROP FUNCTION IF EXISTS insert_unsent_notification_to_history(uuid, text, uuid, text, interval); +DROP FUNCTION IF EXISTS insert_unsent_notification_to_history( + uuid, text, uuid, text, interval, + uuid, uuid, uuid, uuid, uuid, uuid, text +);
🤖 Fix all issues with AI agents
In `@views/021_notification.sql`:
- Around line 86-89: The dedupe UPDATE is overwriting existing body_payload with
NULL when the caller omits p_body_payload; change the assignment for
body_payload in the UPDATE to preserve the stored value unless a new payload is
explicitly provided by using a conditional expression (e.g., COALESCE or CASE)
that sets body_payload = p_body_payload only when p_body_payload IS NOT NULL,
otherwise leaves the current body_payload unchanged; update the assignment
referencing body_payload and p_body_payload accordingly.
Drop the old 13-parameter function signature to prevent PostgreSQL function overloading issues where callers might hit the old function instead of the new one with body_payload parameter.
…ion_to_history - Test saving body_payload for unsent notifications - Test updating body_payload on duplicate notification (deduplication)
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.