Strategies for handling one-to-many or many-to-many relations #583
-
Maybe not so much a supabase/realtime question but working with realtime stuff in general. I have realtime setup with realtime-js. As in the examples I fetch the initial data from an api, using TypeORM, with which I set op a many-to-one relationship (for example comments to a user). My api returns something like this {
"id": "1",
"owner": {
"id": "1",
"name": "Joe"
}
} Under the hood in the table I understand in firebase working with relations is also not super trivial to do. Unless you're storing entire collections under an object, but that's not ideal. I can imagine writing my own backend logic that suits my needs (keeping slices of data in sync in many to many relationships on the object, a valid strategy in firebase). Or is this something that down the road realtime is gonna be able to support? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hey @kapoko - thanks for the patience. We're still brainstorming on this one. I shared some thoughts in another issue, and here is the current thinking: https://paul.copplest.one/blog/realtime-user-store.html We are working on our CLI this quarter, and I hope that it will incrementally move us towards a solution where we can generate your schema into a set of "subscription rules". This would mean that you can fetch your data using PostgREST, then the data is constantly kept in sync through our Realtime engine. We re-enginered our supabase-js library earlier to have one socket-connection per "client" (previously it would generate a connection per "subscribe()") and so the parts are slowly falling into place. If you have some more ideas on this feel free to drop them here! its quite tricky to solve timely dataflow, and we're still figuring out how all the pieces can fit together to make sure the dev experience is seamless |
Beta Was this translation helpful? Give feedback.
Hey @kapoko - thanks for the patience. We're still brainstorming on this one. I shared some thoughts in another issue, and here is the current thinking: https://paul.copplest.one/blog/realtime-user-store.html
We are working on our CLI this quarter, and I hope that it will incrementally move us towards a solution where we can generate your schema into a set of "subscription rules". This would mean that you can fetch your data using PostgREST, then the data is constantly kept in sync through our Realtime engine. We re-enginered our supabase-js library earlier to have one socket-connection per "client" (previously it would generate a connection per "subscribe()") and so the parts are slowly …