feat(ai-persistence-drizzle): schema-first ownership, Postgres provider, schema subpaths#994
feat(ai-persistence-drizzle): schema-first ownership, Postgres provider, schema subpaths#994tombeckenham wants to merge 2 commits into
Conversation
…grations Stop publishing SQL migrations and a default bundled schema from the drizzle adapter. Apps own DDL via tanstack-ai-drizzle-schema + their drizzle-kit journal; drizzlePersistence requires an injected schema. sqlitePersistence keeps local defaults via createDefaultSqliteSchema and optional runtime CREATE TABLE IF NOT EXISTS bootstrap.
…errupt indexes
- drizzlePersistence(db, { provider: 'sqlite' | 'pg', schema }): one entry,
overload-discriminated so db/provider/schema must agree at compile time,
with a runtime dialect guard (is PgDatabase / BaseSQLiteDatabase) and a
provider-aware schema assertion
- Dialect-neutral contract: TanstackAiTableShapes single source of truth,
projected as TanstackAiSqliteSchema and TanstackAiPgSchema
- Postgres: createDefaultPgSchema (jsonb/bigint), ensurePgTables bootstrap,
pg starter asset via tanstack-ai-drizzle-schema --dialect pg, and a
conformance suite against real Postgres (pglite)
- Schema subpath exports /sqlite-schema and /pg-schema so stock-table users
re-export one line into their drizzle-kit paths instead of copying a file
- Default lookup indexes on interrupts (thread_id, run_id) across defaults,
starters, and the ensure* bootstraps
- Stores stay a single SQLite-typed implementation; the pg pair is re-faced
at one documented seam in drizzlePersistence
- Docs (drizzle/sql-backends/migrations), middleware skill, changeset, and
Cloudflare D1 call site updated
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Changeset Version Preview17 package(s) bumped directly, 36 bumped as dependents. 🟥 Major bumps
🟨 Minor bumps
🟩 Patch bumps
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
|
View your CI Pipeline Execution ↗ for commit db53bb0
☁️ Nx Cloud last updated this comment at |
@tanstack/ai
@tanstack/ai-acp
@tanstack/ai-angular
@tanstack/ai-anthropic
@tanstack/ai-bedrock
@tanstack/ai-claude-code
@tanstack/ai-client
@tanstack/ai-code-mode
@tanstack/ai-code-mode-skills
@tanstack/ai-codex
@tanstack/ai-devtools-core
@tanstack/ai-durable-stream
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-grok-build
@tanstack/ai-groq
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-mcp
@tanstack/ai-memory
@tanstack/ai-mistral
@tanstack/ai-ollama
@tanstack/ai-openai
@tanstack/ai-opencode
@tanstack/ai-openrouter
@tanstack/ai-persistence
@tanstack/ai-persistence-cloudflare
@tanstack/ai-persistence-drizzle
@tanstack/ai-persistence-prisma
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-react-ui
@tanstack/ai-sandbox
@tanstack/ai-sandbox-cloudflare
@tanstack/ai-sandbox-daytona
@tanstack/ai-sandbox-docker
@tanstack/ai-sandbox-local-process
@tanstack/ai-sandbox-sprites
@tanstack/ai-sandbox-vercel
@tanstack/ai-solid
@tanstack/ai-solid-ui
@tanstack/ai-svelte
@tanstack/ai-utils
@tanstack/ai-vue
@tanstack/ai-vue-ui
@tanstack/openai-base
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
commit: |
🎯 Changes
Stacked on #984. Evolves the Drizzle persistence backend to schema-first ownership with SQLite + Postgres support behind one provider-discriminated entry:
drizzlePersistence(db, { provider: 'sqlite' | 'pg', schema })— overloads pair the db, provider, and schema dialects at compile time (@ts-expect-error-verified in type tests); a runtimeis()guard and a provider-aware schema assertion re-verify at construction.TanstackAiTableShapesis the single source of truth, projected onto SQLite (TanstackAiSqliteSchema) and Postgres (TanstackAiPgSchema) table types. Renames, drizzlecasing, and app-owned columns stay free.createDefaultPgSchema(jsonb/bigint),ensurePgTablesbootstrap,tanstack-ai-drizzle-schema --dialect pgstarter, and a full conformance suite against real Postgres (PGlite)./sqlite-schemaand/pg-schemaexports: stock-table users re-export one line into their drizzle-kit paths and migrations track package upgrades; the emit-CLI remains for owned/customized schemas (renames, extra columns, index tuning).interrupts.thread_id/interrupts.run_id(the columns the stores list by), emitted by the bootstraps and shipped in defaults + starters.drizzle,sql-backends,migrations,client-persistencefix), middleware skill, changeset, and the Cloudflare D1 call site updated.✅ Checklist
pnpm run test:pr.🚀 Release Impact