Open mcmah309 opened 4 months ago
Thanks for reporting the issue. I've seen at least one other report of the same issue, and we'll implement a validation for this.
is there a better way to recover without losing user data?
You could probably replace the ids in the ps_crud
table if you need to keep the data, e.g. update ps_crud set id = cast(id as text)
. I do imagine this issue should be picked up before production in most cases though, since it will affect all writes to that table.
I got into a state where https://github.com/powersync-ja/powersync.dart/blob/512357877a50d1ac0b7c32ea08ce302336c94a51/packages/powersync/lib/src/crud.dart#L86 was failing since somehow
data['id']
was anint
. I didn't see an easy way to resolve this so I had to runTo drop the queue. I believe this resulted from me accidentally writing something like
Instead of
Which messed up all of syncing, even if I deleted the original code/table. Ideally a mistake like this would never make it to production, but if it did, is there a better way to recover without losing user data? Or at least in this case, validate early so for essential fields these situations cannot occur.
It is worth noting that all subsequent inserts would not sync until
ps_crud
was dropped.