Skip to content

feat: add DataSync plugin with adapter pattern#137

Open
selenaalpha77-sketch wants to merge 2 commits intoouterbase:mainfrom
selenaalpha77-sketch:feat/data-sync-plugin
Open

feat: add DataSync plugin with adapter pattern#137
selenaalpha77-sketch wants to merge 2 commits intoouterbase:mainfrom
selenaalpha77-sketch:feat/data-sync-plugin

Conversation

@selenaalpha77-sketch
Copy link
Copy Markdown

/claim #72
/attempt #72

Changes

Implements DataSyncPlugin following maintainer feedback on PR #75.

Adapter pattern: DB-specific logic in DataSyncAdapter subclasses (PostgresSync, MySQLSync). New engine = new subclass, no changes to DataSyncPlugin itself.

Configurable trackingColumn per table: no hardcoded column names.

Schema prefix handling: public.tablename stripped to tablename in SQLite table creation and beforeQuery hook.

tmp_ prefix: metadata table is tmp_data_sync_metadata.

Cloudflare alarms: dataSource.rpc.setAlarm(nextTime). No setInterval.

24 unit tests, all passing.

Closes #72

Implements DataSyncPlugin following maintainer feedback on PR outerbase#75:
- Adapter pattern: PostgresSync and MySQLSync classes extend DataSyncAdapter
- Configurable trackingColumn per table (no hardcoded column names)
- Strips public. schema prefix in SQLite table creation and beforeQuery hook
- Metadata table named tmp_data_sync_metadata (tmp_ prefix convention)
- Uses Durable Object alarms (not setInterval) via dataSource.rpc.setAlarm
- 24 tests covering plugin lifecycle, query rewriting, sync logic, and type mapping

Closes outerbase#72
Follows the standard plugin structure used by all other StarbaseDB plugins
(cron, stripe, resend, etc.) — every plugin ships with README.md and meta.json.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replicate data from external source to internal source with a Plugin

1 participant