Skip to content

feat(database): add SQL live updates via triggers and change-log - #1602

Open
JohnChantz wants to merge 4 commits into
feat/database-realtime-mongofrom
feat/database-realtime-sql
Open

JohnChantz wants to merge 4 commits into
feat/database-realtime-mongofrom
feat/database-realtime-sql

Conversation

@JohnChantz

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other (please describe)

Does this PR introduce a breaking change?

  • Yes
  • No

The PR fulfills these requirements:

  • It's submitted to the main branch
  • When resolving a specific issue, it's referenced in the PR's description (e.g. fix #xxx, where "xxx" is the issue number)

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature

Other information:

Split from #1594 (3/3). Stacked on #1601 (Mongo live updates), which is stacked on #1600 (event relays).

Extends the same metadata-only live-update contract beyond MongoDB. PostgreSQL, MySQL, MariaDB, and SQLite emit change events via table triggers and a durable internal change-log. The Mongo coordinator is generalized to ChangeStreamCoordinator so both engines share leadership, resume, and room fan-out.

Test plan

  • SQL builder unit tests (sql-builders.test.ts) plus coordinator/status unit tests
  • Opt a SQL schema in with realtime.enabled, mutate a row, confirm a change event with no document payload
  • Confirm trigger/change-log objects are created only for opted-in schemas

Extend realtime beyond MongoDB so PostgreSQL, MySQL, MariaDB, and SQLite
emit the same metadata-only change events using table triggers and a
durable internal log.
@kkopanidis
kkopanidis force-pushed the feat/database-realtime-sql branch from 9828bce to 3031479 Compare September 11, 2026 17:44
cursor Bot pushed a commit that referenced this pull request Sep 13, 2026
Same-name cnd_rt_* triggers from #1602 still pointed at
conduit_realtime_capture / inline _id. DROP and CREATE when the
function or body does not match the physical PK so custom-PK DML
no longer aborts. Document the 750ms occurred_at lag window.
…1607)

* fix(database): make SQL live updates a crash-safe change queue

Persist resume tokens after a successful emit, serialize consume, and
trim the changelog only after Redis ack. Triggers use the schema PK,
LISTEN is probed, Redis keys are SQL-scoped, and opt-out no longer
recreates live triggers.

* fix(database): retarget leftover SQL live-update triggers

Same-name cnd_rt_* triggers from #1602 still pointed at
conduit_realtime_capture / inline _id. DROP and CREATE when the
function or body does not match the physical PK so custom-PK DML
no longer aborts. Document the 750ms occurred_at lag window.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
});

it('does not persist a later token when emit fails', async () => {
const { coordinator, stream, grpcSdk, adminPush } = createCoordinator({
feat(database): capture live updates via Postgres pgoutput
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