Skip to content

Commit eac3b57

Browse files
docs: add missing sync role step
1 parent c4376ae commit eac3b57

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

packages/e2ee-chat/README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,19 @@ Run the frontend at the printed URL once the dev server starts.
4040
# or when no new migration file is required
4141
pnpm --filter @app/chat-e2ee supabase:db:push
4242
```
43-
3. Copy `infra/powersync/sync_rules.yaml` into your PowerSync dashboard so the client can sync the encrypted tables.
44-
4. Populate `frontend/.env.local` with the Supabase URL and anon key from the dashboard (see Quickstart above).
43+
3. In the Supabase SQL editor, run the statements from `infra/roles.sql` (or paste them directly) to create the PowerSync database role and publication. PowerSync expects the publication to be named `powersync`:
44+
```sql
45+
-- Create a role/user with replication privileges for PowerSync
46+
CREATE ROLE powersync_role WITH REPLICATION BYPASSRLS LOGIN PASSWORD 'REPLACE_WITH_STRONG_PASSWORD';
47+
GRANT SELECT ON ALL TABLES IN SCHEMA public TO powersync_role;
48+
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO powersync_role;
49+
50+
-- Create a publication to replicate tables.
51+
-- You can scope this to specific tables if needed, but the publication name must stay "powersync".
52+
CREATE PUBLICATION powersync FOR ALL TABLES;
53+
```
54+
4. Copy `infra/powersync/sync_rules.yaml` into your PowerSync dashboard so the client can sync the encrypted tables.
55+
5. Populate `frontend/.env.local` with the Supabase URL and anon key from the dashboard (see Quickstart above).
4556

4657
If you ever need a fresh database during development, run `pnpm --filter @app/chat-e2ee migrate:reset` to drop and reapply the schema locally. To repair discrepancies between your migrations and the remote database, use the Supabase CLI’s `migration repair` command as documented by Supabase.
4758

0 commit comments

Comments
 (0)