fix: storage bucket migrations fail on current Supabase (SQLSTATE 42501) - #3134
fix: storage bucket migrations fail on current Supabase (SQLSTATE 42501)#3134aacarcrash wants to merge 1 commit into
Conversation
…ations (onlook-dev#3133) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@aacarcrash is attempting to deploy a commit to the Onlook Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe storage migrations no longer delete buckets or objects. They upsert ChangesStorage bucket migrations
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to This change replaces rejected direct storage-table deletes with conflict-safe upserts so fresh database setup can complete while preserving the intended bucket configuration. No actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
Description
Fresh self-hosts fail during
supabase startat migration0008_preview-img-storage.sql:0008and0012_file-transfer-bucket.sqlstart with direct deletes againststorage.objects/storage.buckets, which recent Supabase versions reject — so the backend never comes up on a fresh clone with a current CLI (hit with 2.75.0; the pinned ^2.45.5 still passes).On a fresh database the deletes are no-ops, so this replaces each delete+insert pair with an upsert (
insert ... on conflict (id) do update) — identical end state, no direct writes the storage privilege model forbids.Related Issues
Fixes #3133
Type of Change
Testing
supabase starton a fresh database completes all migrations; both buckets exist with correct visibility (preview_imagespublic,file_transferprivate)Additional Notes
One behavior difference worth a conscious review: the old code also wiped existing objects in these buckets when re-applied; the upsert preserves them. On fresh databases (the only place these migrations run in practice) there is no difference.
Summary by CodeRabbit