Skip to content

Commit e9600bb

Browse files
committed
Bring supabase guide instructions in line with updated video
1 parent 8296252 commit e9600bb

12 files changed

+49
-47
lines changed
11.2 KB
Loading

images/installation/edit-instance.png

269 KB
Loading
Loading
1.52 MB
Loading
65.6 KB
Loading
845 KB
Loading
147 KB
Loading
Binary file not shown.

integration-guides/supabase-+-powersync.mdx

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ sidebarTitle: Overview
66

77
import CreateCloudInstance from '/snippets/create-cloud-instance.mdx';
88
import SupabaseConnection from '/snippets/supabase-database-connection.mdx';
9+
import ConfigureSyncRules from '/snippets/configure-sync-rules.mdx';
910

1011
<Frame caption="Video walkthrough of the integration guide.">
1112
<iframe width="1005" height="420" src="https://www.youtube.com/embed/Xg5FTYGPn5U?si=4TjdYEACDR2g98yh" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></Frame>
@@ -118,35 +119,7 @@ create publication powersync for table public.lists, public.todos;
118119
<SupabaseConnection />
119120

120121
### Configure Sync Rules
121-
122-
[Sync Rules](/usage/sync-rules) allow developers to control which data gets synced to which user devices using a SQL-like syntax in a YAML file. For the demo app, we're going to specify that each user can only see their own to-do lists and list items.
123-
124-
1. To update your sync rules, open the `sync-rules.yaml` file.
125-
126-
<Frame>
127-
<img src="/images/integration-5.png" />
128-
</Frame>
129-
130-
2. Replace the `sync-rules.yaml` file's contents with the below:
131-
132-
```yaml
133-
bucket_definitions:
134-
user_lists:
135-
# Separate bucket per To-Do list
136-
parameters: select id as list_id from lists where owner_id = request.user_id()
137-
data:
138-
- select * from lists where id = bucket.list_id
139-
- select * from todos where list_id = bucket.list_id
140-
```
141-
142-
3. In the top right, click **"Validate sync rules"** and ensure there are no errors. This validates your sync rules against your Postgres database.
143-
4. In the top right, click **"Deploy sync rules"** and select your instance.
144-
5. Confirm in the dialog and wait a couple of minutes for the deployment to complete.
145-
146-
<Tip>
147-
- For additional information on PowerSync's Sync Rules, refer to the [Sync Rules](/usage/sync-rules) documentation.
148-
- If you're wondering how Sync Rules relate to Supabase Postgres [RLS](https://supabase.com/docs/guides/auth/row-level-security), see [this subsection](/integration-guides/supabase-+-powersync/rls-and-sync-rules).
149-
</Tip>
122+
<ConfigureSyncRules />
150123

151124
## Test Everything (Using Our Demo App)
152125

snippets/configure-sync-rules.mdx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[Sync Rules](/usage/sync-rules) allow developers to control which data gets synced to which user devices using a SQL-like syntax in a YAML file. For the demo app, we're going to specify that each user can only see their own to-do lists and list items.
2+
3+
1. The final step is to replace the Sync Rules file's contents with the below:
4+
5+
```yaml
6+
bucket_definitions:
7+
user_lists:
8+
# Separate bucket per To-Do list
9+
parameters: select id as list_id from lists where owner_id = request.user_id()
10+
data:
11+
- select * from lists where id = bucket.list_id
12+
- select * from todos where list_id = bucket.list_id
13+
```
14+
15+
<Frame>
16+
<img src="/images/installation/overview-sync-rules.png" />
17+
</Frame>
18+
19+
3. Click **"Validate sync rules"** and ensure there are no errors. This validates your sync rules against your Postgres database.
20+
4. Click **"Save and deploy"** to deploy your Sync Rules.
21+
22+
<Tip>
23+
- Your Sync Rules can be updated by navigating to the **Manage instances** workspace and selecting the `sync-rules.yaml` file.
24+
<img src="/images/installation/update-sync-rules.png" width="60%" />
25+
- For additional information on PowerSync's Sync Rules, refer to the [Sync Rules](/usage/sync-rules) documentation.
26+
- If you're wondering how Sync Rules relate to Supabase Postgres [RLS](https://supabase.com/docs/guides/auth/row-level-security), see [this subsection](/integration-guides/supabase-+-powersync/rls-and-sync-rules).
27+
</Tip>

0 commit comments

Comments
 (0)