Skip to content

Add powersync_trigger_resync#166

Merged
simolus3 merged 2 commits into
mainfrom
trigger-resync
Feb 16, 2026
Merged

Add powersync_trigger_resync#166
simolus3 merged 2 commits into
mainfrom
trigger-resync

Conversation

@simolus3

Copy link
Copy Markdown
Contributor

This adds the powersync_trigger_resync function. It updates ps_buckets to set last_applied_op = 0 on buckets. This causes the sync client to re-apply all changes the next time it receives a checkpoint-complete message, without throwing any local rows away. And unlike a soft-clear, this also doesn't clear the crud upload queue.

This function is mainly useful when migrating raw tables, see this section for details.

@simolus3
simolus3 requested a review from rkistner February 16, 2026 10:24

@rkistner rkistner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also clear the hasSynced status here. But the progress counts can stay as-is? I haven't thought through every scenario here yet.

@rkistner

Copy link
Copy Markdown
Contributor

On second thought, that probably doesn't apply to all cases. Maybe that should be opt-in or a separate function call?

@simolus3

Copy link
Copy Markdown
Contributor Author

Maybe that should be opt-in or a separate function call?

I've added this as a parameter: powersync_trigger_resync(0) would keep lastSyncedAt and hasSynced, powersync_trigger_resync(1) clears it.

@simolus3
simolus3 merged commit 428ef83 into main Feb 16, 2026
25 checks passed
@simolus3
simolus3 deleted the trigger-resync branch February 16, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants