You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(migrations): tolerate missing postgres role in rls grant migration
Wrap the grant-select-to-postgres block in an existence check so
self-hosted deployments using a non-default DB superuser no longer
crash-loop on first start with `ERROR: role "postgres" does not exist`.
RLS is still enabled unconditionally on every auth table; only the
grants are gated on the role actually existing. This matches the
intent of the upstream Supabase migration without breaking custom
Postgres setups.
Documented in appflowy/APPFLOWY_BRANCH_MIGRATION_HISTORY.md so the
patch is re-applied on every master merge.
Refs AppFlowy-Cloud#1615
Copy file name to clipboardExpand all lines: appflowy/APPFLOWY_BRANCH_MIGRATION_HISTORY.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,6 +66,19 @@ mindmap
66
66
67
67
---
68
68
69
+
### In-Place Patches to Upstream Migrations
70
+
71
+
In addition to the cherry-picked feature commits, the following upstream files
72
+
have been modified in place. Re-apply these on every merge from master:
73
+
74
+
| File | Patch | Why |
75
+
|------|-------|-----|
76
+
|`migrations/20240612123726_enable_rls_update_grants.up.sql`| Wraps the `grant select … to postgres with grant option` block in `if exists (select 1 from pg_roles where rolname = 'postgres') then … end if;`| Upstream hardcodes the `postgres` role. Self-hosted deployments using a non-default DB superuser hit `ERROR: role "postgres" does not exist (SQLSTATE 42704)` and crash-loop on first start. RLS is still enabled unconditionally; only the grants are gated. See AppFlowy-Cloud issue #1615. |
77
+
78
+
**On every master merge:** check `git diff master..HEAD -- migrations/20240612123726_enable_rls_update_grants.up.sql` is non-empty and the conditional is still present. If a merge undoes the patch (e.g., upstream rewrites the file), re-apply the gate before tagging a release.
79
+
80
+
---
81
+
69
82
## Verification: Master Does NOT Have These
70
83
71
84
✅ **All 11 commits are necessary** - Verified against current master (commit `4e8275f`):
0 commit comments