-
Notifications
You must be signed in to change notification settings - Fork 7
Simpler crud vtab, part 1 #89
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
I don't think this needs a special migration because the old triggers will continue to work. And since There are some failures in the migration tests - mainly because the triggers at older versions look different to the triggers now. I think the only good way to fix these tests is to expect the current trigger definitions everywhere (which is a bit odd when e.g. testing a migration from version 3 to 5, but I don't think the triggers itself should be versioned here). |
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.
Thanks, I like the new table structure.
To automatically associate local writes with a transaction id, we use a
powersync_crud_
eponymous-only virtual table tracking started transactions and forwarding writes tops_crud
.But for most writes (the only exception are inserts to insert-only tables), writes actually involve three steps:
ps_crud
entry through the vtab.ps_updated_rows
.$local
bucket as dirty.Since the last two steps are almost always the same, this introduces a new
powersync_crud
virtual table (without a trailing underscore) that behaves almost identical topowersync_crud_
, but:ps_updated_rows
for the correct row / type.$local
.A future step is to make
powersync_crud
inserts a nop duringsync_local
, simplifying custom triggers for raw tables. I've done this in the raw tables PR.