Skip to content

chore: upgrade database drivers and replace sqlite3 with node:sqlite - #262

Merged
joe-re merged 1 commit into
releasefrom
chore/upgrade-db-drivers
Sep 25, 2026
Merged

joe-re merged 1 commit into
releasefrom
chore/upgrade-db-drivers

Conversation

@joe-re

@joe-re joe-re commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Summary

Phase 5 of the maintenance plan: database drivers.

sqlite3 -> node:sqlite

  • The sqlite3 adapter now uses the built-in node:sqlite (DatabaseSync, read-only). The native sqlite3 package, electron-rebuild, and the "Rebuild SQLite3 Client" command are removed.
  • node:sqlite is loaded lazily via process.getBuiltinModule, so its experimental warning only appears for sqlite3 users.
  • Verified that node:sqlite works under ELECTRON_RUN_AS_NODE=1 on Electron 35.5.1 (Node 22.15, VS Code 1.101) and Electron 39.8.8 (VS Code 1.120). The extension now requires VS Code 1.101+.
  • A failure to open the file is reported as Failed to open sqlite3 database: <reason> instead of the misleading "Need to rebuild sqlite3 module."

Other drivers

  • mysql2 2 -> 3, pg 8.10 -> 8.23 (both moved to their promise APIs); the temporary pg / pg-protocol pins are gone
  • @google-cloud/bigquery 5 -> 9 (6/7/8/9 breaking changes are Node version requirements only; not tested against a real project)

SSH tunnel

  • Replaced the unmaintained node-ssh-forward with a small ssh2 based tunnel (sshTunnel.ts). ssh2's optional native addons are excluded from the bundle; it falls back to pure JS.
  • Bug fixes: ssh.remotePort was never passed (always 22), ~/ in ssh.identityFile was not expanded (the README examples use it), and the tunnel leaked when the DB connection failed.

Bug fixes found along the way

  • Table names were interpolated into SQL (sqlite3 / mysql / postgres). They are now parameters or escaped identifiers, so names containing quotes work.
  • The Null column in column descriptions was inverted for sqlite3, and postgres returned true/false for NOT NULL. Both now match mysql (Yes = nullable).

Tests / CI

  • New sqlite3 tests (always run)
  • New MySQL / Postgres integration tests, enabled with SQLLS_TEST_MYSQL / SQLLS_TEST_POSTGRES; a new db-integration CI job runs them with mysql:8.4 / postgres:17 service containers
  • docker-compose: postgres 10 -> 17, mysql -> 8.4

Test plan

  • build / lint / typecheck / vsc-compile / all tests on Node 22 (server 122 passed + 7 DB tests skipped without env; parser 68; sqlint 36)
  • DB integration tests against local postgres:17 and mysql:8.4 containers: 7 passed
  • SSH tunnel: sshd container + Postgres reachable only inside the docker network; schema fetched through the tunnel using remotePort, ~/ identityFile and a passphrase-protected key
  • Same SSH setup through the esbuild CLI bundle over LSP stdio: the tunneled table shows up in completion
  • VS Code server bundle answers initialize over node-ipc
  • BigQuery against a real project (not available)

Known issue (not changed here)

The server reads only the deprecated InitializeParams.rootPath, so clients that send only rootUri / workspaceFolders do not get project config loaded. Worth a separate fix.

- sqlite3 adapter uses the built-in node:sqlite (read-only) instead of the
  native sqlite3 package; remove the electron-rebuild based "Rebuild SQLite3
  Client" command. VS Code 1.101 (Electron 35 / Node 22.15) is required.
- mysql2 2 -> 3 and pg 8.10 -> 8.23 using their promise APIs; drop the
  temporary pg / pg-protocol pins
- @google-cloud/bigquery 5 -> 9 (only Node version requirements changed)
- Replace node-ssh-forward with a small ssh2 based tunnel. ssh.remotePort
  was not passed before, and "~/" in identityFile was not expanded. The
  tunnel is now also closed when connecting to the database fails.
- Pass table names as parameters / escaped identifiers instead of
  interpolating them into SQL
- Fix inverted "Null" column in sqlite3 / postgres column descriptions
- Add sqlite3 tests and opt-in MySQL / Postgres integration tests
  (SQLLS_TEST_MYSQL / SQLLS_TEST_POSTGRES), run in a CI job with service
  containers
- docker-compose: postgres 10 -> 17, mysql -> 8.4
@joe-re
joe-re merged commit e0ab122 into release Sep 25, 2026
3 checks passed
@joe-re
joe-re deleted the chore/upgrade-db-drivers branch September 25, 2026 17:10
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.

1 participant