Skip to content

Move SQLite persistence to Effect SQL and Drizzle - #192

Merged
alandotcom merged 6 commits into
mainfrom
cursor/effect-sqlite-drizzle
Sep 2, 2026
Merged

Move SQLite persistence to Effect SQL and Drizzle#192
alandotcom merged 6 commits into
mainfrom
cursor/effect-sqlite-drizzle

Conversation

@alandotcom

Copy link
Copy Markdown
Owner

Replace production node:sqlite repository access with drizzle-orm/effect-sqlite-node while preserving wfSqlite(), stored data, repository contracts, and transaction behavior. This moves connection lifecycle and serialized BEGIN IMMEDIATE writes into Effect SQL and makes generated Drizzle migrations the schema source of truth.

Review guide

Start with packages/core/src/backend/persistence/sqlite/migrations.ts and database.ts, then the generated schema and migration tests. The main risk surfaces are legacy database adoption, rollback under failed migrations, and the installed-package path for the patched Drizzle adapter.

What changed

  • Adopt exact version 6 and 7 SQLite schemas into __wfgraph_sqlite_migrations without rewriting application tables. Reject older, partial, altered, tampered, or newer schemas instead of guessing.
  • Run migration inspection, adoption, journal validation, generated SQL, foreign-key checks, and final fingerprint validation in one transaction.
  • Convert SQLite repositories to Effect-native Drizzle SQL while retaining payload-safe DatabaseError translation and existing row contracts.
  • Add a generated SQLite baseline and validation script.
  • Patch Drizzle RC4 for Effect RC112 compatibility and bundle the adapter so published consumers do not need the pnpm patch. The upstream fix is rc.5 drizzle-team/drizzle-orm#5966.
  • Pack and install @wfgraph/core in a clean directory during PR checks, then open and migrate SQLite through the published entry.

Validation

  • pnpm install --frozen-lockfile
  • pnpm run check
  • pnpm run type-check
  • pnpm run lint
  • pnpm run test: 3,289 passed; 37 PostgreSQL tests skipped in the general suite
  • WFGRAPH_REQUIRE_POSTGRES=1 WFGRAPH_TEST_DATABASE_URL=... pnpm run test:postgres: 37 passed
  • pnpm run build
  • pnpm run knip
  • pnpm run skills:validate
  • pnpm run db:generate:sqlite
  • pnpm run package:smoke

Replace direct node:sqlite repository access with the Effect SQLite adapter and Drizzle SQL while preserving the public persistence contract and transaction semantics. Adopt exact legacy version 6 and 7 schemas into a generated migration journal, reject drift and newer journals, and validate migrations atomically.\n\nBundle the patched Drizzle Effect adapter for published consumers and add a packed-tarball smoke test to PR checks.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T00:43:58.960567Z 239b3c3 New commits
🔒 Security Review Completed 2026-09-01T23:59:09.947034Z c70ca83 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Sep 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/@wfgraph/client@239b3c3
pnpm add https://pkg.pr.new/@wfgraph/core@239b3c3
pnpm add https://pkg.pr.new/@wfgraph/plugins@239b3c3

commit: 239b3c3

@alandotcom
alandotcom merged commit c8d007c into main Sep 2, 2026
4 checks passed
@alandotcom
alandotcom deleted the cursor/effect-sqlite-drizzle branch September 2, 2026 01:06
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