-
Notifications
You must be signed in to change notification settings - Fork 168
Add organization_id to review_suggestion_snippets #1525
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
Add organization_id to review_suggestion_snippets #1525
Conversation
Co-Authored-By: noritaka.ikeda@route06.co.jp <noritaka.ikeda@route06.co.jp>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
…into devin/1745585764-add-organization-id-review-suggestion-snippets
… related triggers, policies, and database types
This migration adds an organization_id column to review_suggestion_snippets along with a new trigger and RLS policies. The key issues include lack of null-check validation in the trigger and missing index on organization_id, with a potential mismatch between the TS types and database constraints. Overall, the migration follows project conventions and improves security isolation, but clarifying the TS type expectation is important. ER Diagram: |
|
||
ALTER TABLE "public"."review_suggestion_snippets" ENABLE ROW LEVEL SECURITY; | ||
|
||
CREATE POLICY "authenticated_users_can_select_org_review_suggestion_snippets" |
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.
- Authenticated users can only view review suggestion snippets that belong to organizations they are members of.
- Service role can insert review suggestion snippets without restriction.
If you're curious where this table is used, try grepping for.from('review_suggestion_snippets')
in the codebase.
PR Reviewer Guide 🔍(Review updated until commit c511a74)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to c511a74
Previous suggestionsSuggestions up to commit 197a638
|
…into devin/1745585764-add-organization-id-review-suggestion-snippets
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.
👍🏻
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.
LGTM!!!
Thank you so much!🌟
…suggestion-snippets
Updates to Preview Branch (devin/1745585764-add-organization-id-review-suggestion-snippets) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
Issue
Why is this change needed?
This PR adds the
organization_id
column to thereview_suggestion_snippets
table and implements RLS policies to ensure data is properly isolated by organization. This is part of the ongoing effort to add organization-based row-level security to all tables.What would you like reviewers to focus on?
Testing Verification
Changes were verified by reviewing the migration file and type overrides against similar implementations in other tables.
Note: Type generation failed due to Docker rate limits, but type overrides were created following the established pattern.
What was done
🤖 Generated by PR Agent at 197a638
organization_id
column toreview_suggestion_snippets
tableorganization_id
from related feedbackDetailed Changes
schema.sql
Add organization_id, triggers, and RLS to review_suggestion_snippets
frontend/packages/db/schema/schema.sql
organization_id
column toreview_suggestion_snippets
database.types.ts
Update types for review_suggestion_snippets organization_id
frontend/packages/db/supabase/database.types.ts
organization_id
to Row, Insert, Update types forreview_suggestion_snippets
20250426000000_add_organization_id_to_review_suggestion_snippets.sql
Migration for organization_id and RLS on review_suggestion_snippets
frontend/packages/db/supabase/migrations/20250426000000_add_organization_id_to_review_suggestion_snippets.sql
organization_id
column and populate dataindex.ts
Add review_suggestion_snippets override to database types
frontend/packages/db/src/types/supabase-overrides/index.ts
review_suggestion_snippets.ts
Add type override for review_suggestion_snippets organization_id
frontend/packages/db/src/types/supabase-overrides/review_suggestion_snippets.ts
Additional Notes