fix(migration): permission group migration error#4258
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview It switches DDL to Reviewed by Cursor Bugbot for commit 060472e. Configure here. |
Greptile SummaryThis PR hardens the Confidence Score: 5/5Safe to merge — all changes are idempotency improvements with no destructive or data-altering new logic; only remaining comments are minor style suggestions. Every changed statement is a guard addition (IF NOT EXISTS / IF EXISTS) or the new step 1b DROP NOT NULL, which is a no-op when the column is already nullable. No P0/P1 defects were found; the two inline comments are P2 style improvements to the schema filter in the information_schema lookups. No files require special attention; the migration logic is sound. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
S0["Step 0: Backfill workspace→org links\n(grandfathered workspaces)"]
S1["Step 1: ADD COLUMN IF NOT EXISTS\nworkspace_id on permission_group\n& permission_group_member"]
S1FK["Add FK constraints\n(DO $$ IF NOT EXISTS $$)"]
S1b["Step 1b: DROP NOT NULL on\npermission_group.organization_id\n🆕 new in this PR"]
S2["Step 2: CREATE TEMP TABLE\n__permission_group_clone_plan\nON COMMIT DROP"]
S3["Step 3: INSERT cloned\npermission_group rows\n(organization_id = NULL)"]
S4["Step 4: Copy permission_group_member\nrows to workspace clones"]
S5["Step 5: DELETE legacy\norg-scoped rows"]
S6["Step 6: SET NOT NULL\non both workspace_id columns"]
S7["Step 7: DROP IF EXISTS old constraints/indexes\nCREATE IF NOT EXISTS new indexes"]
S8["Step 8: Sweep residual\nconfig keys"]
S0 --> S1 --> S1FK --> S1b --> S2 --> S3 --> S4 --> S5 --> S6 --> S7 --> S8
style S1b fill:#ffd700,stroke:#b8860b
style S1 fill:#90EE90,stroke:#228B22
style S1FK fill:#90EE90,stroke:#228B22
style S7 fill:#90EE90,stroke:#228B22
Reviews (1): Last reviewed commit: "fix(migration): permission group migrati..." | Re-trigger Greptile |
Summary
Fix broken migration
Type of Change