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). |
rkistner
left a comment
There was a problem hiding this comment.
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_crudentry through the vtab.ps_updated_rows.$localbucket as dirty.Since the last two steps are almost always the same, this introduces a new
powersync_crudvirtual table (without a trailing underscore) that behaves almost identical topowersync_crud_, but:ps_updated_rowsfor the correct row / type.$local.A future step is to make
powersync_crudinserts a nop duringsync_local, simplifying custom triggers for raw tables. I've done this in the raw tables PR.