Skip to content

✨ 支持远端 SQLite VFS - #200

Merged
CodFrm merged 4 commits into
mainfrom
spike/sqlite-remote-vfs
Jun 17, 2026
Merged

✨ 支持远端 SQLite VFS#200
CodFrm merged 4 commits into
mainfrom
spike/sqlite-remote-vfs

Conversation

@CodFrm

@CodFrm CodFrm commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

变更内容

  • 新增 no-CGO 的 SQLite VFS,通过 SSH/SFTP 直接读写远端 SQLite 文件。
  • 接入数据库资产配置、校验、连接池和前端资产表单,支持选择「本地 SQLite」或「SSH 远程 SQLite」。
  • 本地 SQLite 行为保持不变;远端 SQLite 默认使用 rollback journal,并通过 .opskat.lock 文件保护写连接。
  • 修复 SQLite 查询面板连接缓存:main schema 和空 schema 复用同一个远端文件连接,避免重复拨号触发锁冲突。

Closes #197

验证

  • CGO_ENABLED=0 go test ./internal/connpool ./internal/connpool/sqlitevfs -count=1
  • go test ./internal/app/query ./internal/connpool ./internal/connpool/sqlitevfs ./internal/assettype ./internal/model/entity/asset_entity -count=1
  • cd frontend && pnpm exec vitest run src/components/asset/__tests__/DatabaseConfigSection.config.test.ts src/components/asset/__tests__/DatabaseConfigSection.test.tsx src/components/asset/__tests__/SSHConfigSection.test.tsx
  • cd e2e && pnpm run test:scratch scratch/remote-sqlite-ssh.spec.ts,使用 root@docker.local 验证真实 SSH 远端 SQLite 流程
  • CGO_ENABLED=0 OPSKAT_SQLITEVFS_SFTP_TEST_TARGET=root@docker.local go test ./internal/connpool/sqlitevfs -run TestSFTPRemoteSQLiteIntegration -count=1 -v
  • git diff --check

说明

  • 目前不默认开放 WAL;VFS 会拒绝未启用 exclusive locking 的 WAL 配置。
  • 本地 e2e 使用的 e2e/scratch/remote-sqlite-ssh.spec.ts 是 gitignored 的临时验证脚本,没有提交到 PR。

@CodFrm
CodFrm merged commit 7a52e7b into main Jun 17, 2026
5 checks passed
@CodFrm
CodFrm deleted the spike/sqlite-remote-vfs branch June 17, 2026 07:48
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.

[Feature] SQLite能否支持远程地址

1 participant