Conversation
rkistner
approved these changes
May 5, 2026
Contributor
rkistner
left a comment
There was a problem hiding this comment.
I'm happy with the changes.
What changes would the client SDKs have to make to cater for these changes? It's not clear to me what "public" APIs are affected by this.
Contributor
Author
This depends on the client SDK:
So the public API (from a core extension perspective) is changed by:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Timestamps for the
last_synced_atfield for priority entries and sync stream status data are encoded as seconds since the unix epoch. As reported in powersync-ja/powersync-js#945, it could make sense to migrate to a higher level of precision.We can get milliseconds out of SQLite by using
unixepoch('subsec'), SQLite docs state that the precision of this might be increased further in the future. This migrates values to store microseconds instead of seconds, which avoids another migration in case we can get higher precision out of SQLite in the future without storing values that are too large (we can't really represent numbers larger than 2^52 in JSON for JavaScript, so nanoseconds are an issue).This migrates existing data:
ps_sync_state, this migrates it to microseconds.Note
The ttl for sync streams is still using seconds. It doesn't really makse sense to increase the precision on that field since the ttl is only checked on keepalive messages which we receive every 20 seconds or so.
To avoid having to
CAST(unixepoch('subsec') * 1_000_000 AS INTEGER)everywhere, this also adds refactoring to make using aStorageAdapter(owning a prepared statement for that) cheaper:powersync_last_synced_at_implfunction has been removed (client SDKs usepowersync_offline_sync_statusinstead).StorageAdapterinDatabaseState, which avoids having to create it (and its associated statements) for some helper functions.