-
Notifications
You must be signed in to change notification settings - Fork 9
Add client-id mapping tutorial #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
); | ||
``` | ||
|
||
The `uploadData` function in `SupabaseConnector.ts` needs to be updated to use the new `uuid` column in both tables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rkistner I'm not entirely sure if anything else is required here w.r.t explanation - it's pretty self explanatory but let me know if there's anything you want me to add
</Step> | ||
</Steps> | ||
|
||
# Data Model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't have a strong opinion here, but I feel like we generally refer to "schema" as opposed to "data model" - so might want to be consistent (though I did see another "data model" ref in the docs now, which we could update too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will update to schema as data model is technically not the correct term to use, but I feel like schema and data model have become synonymous
``` | ||
</CodeGroup> | ||
|
||
With the data mode updated, we now need a method to synchronize and map the `list_id` and `list_uuid` in the `todos` table, with the `id` and `uuid` columns in the `lists` table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo "data mode". should update to schema or data model based on decision above
|
||
# Introduction | ||
When auto-incrementing / sequential IDs are used on the backend database, the ID can only be generated on the backend database, and not on the client while offline. | ||
To handle this, you can use a secondary UUID on the client, then map them to a sequential ID when performing an update on the backend database. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"when performing an update on the backend database" - can we maybe make this clearer by saying "when uploading the record to the backend database" - or is that not technically correct? the current wording makes me think this mapping happens on any update to the backend database
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reply 1:
when performing an update on the backend database"
That actually comes from our existing docs (I just updated server
to backend database
):
Reply 2:
the current wording makes me think this mapping happens on any update to the backend database
I guess there is some level of ambiguity here since the mapping will only occur when either FK columns are updated and not when "any" update occurs.
|
||
# Data Model | ||
|
||
In order to map the UUID to the integer ID, we need to update the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it would be good to mention it's the backend/remote schema/data model specifically, since it doesn't look like we're updating anything on the client-side schema (yet)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We update the client-side schema here.
Edit: Now that I think about it, the Schema section will only refer to the backend schema and not any client-side changes, so I can rename it to Backend Schema
?
|
||
<CodeGroup> | ||
```sql data model {3, 13, 21, 26} | ||
create table public.lists ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be create statements? We're saying "update" above, so that's why I'm a bit confused.
Co-authored-by: benitav <benitav@users.noreply.github.com>
Co-authored-by: benitav <benitav@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with this.
Did a once over and LGTM. |
This PR adds a tutorial on to map sequential IDs to UUIDS.