docs: add database.sql and sync-rules.yaml to react-supabase-todolist demo#921
docs: add database.sql and sync-rules.yaml to react-supabase-todolist demo#921JexanJoel wants to merge 3 commits intopowersync-ja:mainfrom
Conversation
|
simolus3
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
| @@ -0,0 +1,7 @@ | |||
| bucket_definitions: | |||
There was a problem hiding this comment.
Can we use the Sync Stream syntax for this? Also, we should perhaps rename this to sync-streams.yaml.
There was a problem hiding this comment.
Yes we can. btw done Renamed the file to sync-streams.yaml and updated the content to use the sync_streams syntax.
| ); | ||
|
|
||
| -- Create PowerSync role for replication access | ||
| CREATE ROLE powersync_role REPLICATION LOGIN; |
There was a problem hiding this comment.
I guess we should also add a note to set a password then?
There was a problem hiding this comment.
Added a comment with instructions to set a password for the role.
| @@ -0,0 +1,7 @@ | |||
| sync_streams: | |||
There was a problem hiding this comment.
This is not a valid configuration file, it should be something like this:
config:
edition: 3
streams:
user_data:
auto_subscribe: true
queries:
# Separate stream per todo list, scoped to the authenticated user
- SELECT * FROM lists WHERE owner_id = auth.user_id()
- SELECT todos.* FROM todos INNER JOIN lists ON todos.list_id = lists.id WHERE lists.owner_id = auth.user_id()There was a problem hiding this comment.
Updated to use the new format with config: edition: 3 and streams syntax, scoped to the authenticated user. Any changes?
|
I realize we're not consistent with all our demos in this repo yet, but for easier maintainability going forward (not having to update instructions in 20+ demo app Readmes) and approach we adopted in several of the Supabase-based demo app Readmes here is to link to these sections in the docs which should cover all required steps to run the demo (including setting Sync Streams):
I'm curious if you just missed these, or if there's an issue with those instructions, or another reason? |
Fixes #860
The
react-supabase-todolistdemo was missing the Supabase database setup file and PowerSync sync rules that other demos in this repo include (e.g.react-native-web-supabase-todolist).This PR adds:
database.sql- creates thelistsandtodostables, enables RLS with policies scoped toowner_id, and creates thepowersyncpublicationsync-rules.yaml- defines theuser_listsbucket scoped per authenticated userREADME.mdwith numbered step-by-step setup instructions referencing these new files