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
[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
-
<imgsrc="/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).
[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
- 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).
0 commit comments