feat(notif): index chan notifs on msg id#2799
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds a PostgreSQL migration that creates a concurrent index on the Changes
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@rust/cloud-storage/macro_db_client/migrations/20260423120001_idx_notification_channel_message_id.sql`:
- Around line 1-5: The migration creates a concurrent index
notification_channel_message_id_idx on notification ((metadata->>'messageId'))
for event_item_type='channel' but lacks a rollback; add or document a reversible
step by providing the rollback SQL DROP INDEX CONCURRENTLY IF EXISTS
notification_channel_message_id_idx (either in a corresponding "down" migration
file or in the migration workflow notes) and ensure the migration metadata or
tooling references this rollback so the create step in the migration is
reversible.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 87d80c77-caf8-4266-bd59-cc3c84473456
📒 Files selected for processing (1)
rust/cloud-storage/macro_db_client/migrations/20260423120001_idx_notification_channel_message_id.sql
| -- no-transaction | ||
|
|
||
| CREATE INDEX CONCURRENTLY IF NOT EXISTS notification_channel_message_id_idx | ||
| ON notification ((metadata->>'messageId')) | ||
| WHERE event_item_type = 'channel'; |
There was a problem hiding this comment.
Add an explicit rollback path for this migration.
This change is safe forward, but there is no rollback strategy shown. Please add or document the rollback command (DROP INDEX CONCURRENTLY IF EXISTS notification_channel_message_id_idx;) in your migration workflow.
Suggested rollback SQL
+-- rollback
+DROP INDEX CONCURRENTLY IF EXISTS notification_channel_message_id_idx;As per coding guidelines, “Confirm migrations are reversible or have a clear rollback strategy.”
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| -- no-transaction | |
| CREATE INDEX CONCURRENTLY IF NOT EXISTS notification_channel_message_id_idx | |
| ON notification ((metadata->>'messageId')) | |
| WHERE event_item_type = 'channel'; | |
| -- no-transaction | |
| CREATE INDEX CONCURRENTLY IF NOT EXISTS notification_channel_message_id_idx | |
| ON notification ((metadata->>'messageId')) | |
| WHERE event_item_type = 'channel'; | |
| -- rollback | |
| -- DROP INDEX CONCURRENTLY IF EXISTS notification_channel_message_id_idx; |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@rust/cloud-storage/macro_db_client/migrations/20260423120001_idx_notification_channel_message_id.sql`
around lines 1 - 5, The migration creates a concurrent index
notification_channel_message_id_idx on notification ((metadata->>'messageId'))
for event_item_type='channel' but lacks a rollback; add or document a reversible
step by providing the rollback SQL DROP INDEX CONCURRENTLY IF EXISTS
notification_channel_message_id_idx (either in a corresponding "down" migration
file or in the migration workflow notes) and ensure the migration metadata or
tooling references this rollback so the create step in the migration is
reversible.
Add index for chann notifs on msg id