Skip to content

fix: add SQLite connector cloning for multi-source support - #116

Merged
tianzhou merged 1 commit into
bytebase:mainfrom
Yax:claude/fix-issue-115-011CUzHEEXyrdLfbtUpp9xt3
Nov 10, 2025
Merged

fix: add SQLite connector cloning for multi-source support#116
tianzhou merged 1 commit into
bytebase:mainfrom
Yax:claude/fix-issue-115-011CUzHEEXyrdLfbtUpp9xt3

Conversation

@Yax

@Yax Yax commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

Fixes #115 where multiple SQLite databases in multi-source configuration would overwrite each other, leaving only the last database accessible.

Root cause: ConnectorRegistry.getConnectorForDSN() returned singleton instances, so each connect() call overwrote the previous connection.

Solution:

  • Add optional clone() method to Connector interface
  • Implement clone() in SQLiteConnector to create separate instances
  • Update ConnectorManager to use clone() for multi-source configs
  • Other connectors remain unchanged (not tested with multi-source)

Tests:

  • Add comprehensive integration tests for multiple SQLite sources
  • All 9 new tests pass, verifying independent database operations
  • Existing 31 SQLite integration tests still pass
  • Build succeeds with no TypeScript errors

Implements clone() method to prevent connection state sharing between multiple SQLite database sources (fixes bytebase#115)
@Yax
Yax requested a review from tianzhou as a code owner November 10, 2025 13:40

@tianzhou tianzhou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks for the fix

@tianzhou
tianzhou merged commit 923aac0 into bytebase:main Nov 10, 2025
2 checks passed
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.

Multiple SQLite Sources get overwritten and only last one is accessible

3 participants