Skip to content

Conversation

@stevensJourney
Copy link
Collaborator

Overview

The trigger based diff logic currently implements a temporary SQLite table of the form

        CREATE TEMP TABLE destination (
          id TEXT, -- The modified row's id
          operation TEXT,
          timestamp TEXT,
          value TEXT,
          previous_value TEXT
        );

We create and store operations on the configured INSERT, UPDATE and DELETE events.

These operations are currently ordered by the timestamp of the operation which is stored as an ISO string with millisecond resolution. The millisecond resolution is not ideal for this. Certain operations could be executed in a shorter timeframe than the resolution - which can break the ordering of ops!

This PR adds an auto incrementing operation_id column to the tracked table. This ensures operations can be robustly queried in the exact order in which they were executed.

@changeset-bot
Copy link

changeset-bot bot commented Nov 13, 2025

🦋 Changeset detected

Latest commit: 7d0dab7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@powersync/common Minor
@powersync/adapter-sql-js Patch
@powersync/node Patch
@powersync/op-sqlite Patch
@powersync/react-native Patch
@powersync/tanstack-react-query Patch
@powersync/web Patch
@powersync/diagnostics-app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@stevensJourney stevensJourney marked this pull request as ready for review November 13, 2025 13:13
@stevensJourney stevensJourney merged commit 3af4a2c into main Nov 13, 2025
9 of 16 checks passed
@stevensJourney stevensJourney deleted the trigger-op-ids branch November 13, 2025 15:29
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.

3 participants