Repository navigation
feat(db): support Drizzle's casing option in void/db and void db - #494
Conversation
`database` in the Void config now also takes an object,
`{ dialect?: 'sqlite' | 'pg' | 'mysql', casing?: 'snake_case' | 'camelCase' }`.
The string shorthand (`'pg'`, `'mysql'`) is unchanged.
`casing` is passed to every Drizzle instance on the app schema (the
runtime `void/db` module for D1, PostgreSQL and MySQL, and `void db
seed`) and to the drizzle-kit config that `void db generate`, `push` and
the deploy drift check use, so a schema written for `snake_case` gets
snake_case columns from both. Without `casing`, the generated module and
drizzle-kit config are unchanged.
Every reader of `database` goes through getDatabaseDialect or the new
getDatabaseCasing, `void init` keeps the casing when it changes the
dialect, and schema.json accepts the object form. Built-in auth tables
name their columns explicitly, so they are not affected.
Fixes #466
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e467dad055
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Choosing "No database" treated `database: { casing: 'snake_case' }` as
already D1 and left it in place, although casing alone still makes Void
serve `void/db`. Remove the whole `database` field whenever it is set,
as main did for `'pg'` and `'mysql'`. Switching to D1 still keeps the
casing.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@codex review |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://feat-db-casing-void-cloud.voidzero-docs.workers.dev (commit e123ca4)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d289b2817
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ng is set A D1 app's installed packages kept their own void/db, which never gets database.casing. Inline them like PostgreSQL and MySQL apps when casing is configured, so they share the app's virtual module. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd7a2b4b69
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…asing is set A D1 build keeps Kit's output, so installed packages that import void stayed external and loaded their own void/db without database.casing. Bundle them when casing is set, as the dev server now inlines them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #466
What
With
casing: 'snake_case', a column declared without a name (createdAt: timestamp()) is stored ascreated_at, both invoid/dbqueries and in whatvoid db generatewrites.Design
dialectdefaults to"sqlite"(D1).dialector a badcasingeach give a clear config error.schema.jsonaccepts both forms.databasegoes throughgetDatabaseDialect/getDatabaseCasing. That covers application analysis (deploy, Hyperdrive, manifest dialect), the CLI (db,gen,init, wrapper), nitro, routing, the drizzle plugin and the framework plugin.void initkeeps the casing when it changes the dialect.casing, the generatedvoid/dbmodule and the drizzle-kit config are byte-identical tomain. This was checked in all 12 dialect × schema × forced-virtual combinations.introspect.casing) is not touched.casingdoesn't change them. A real sign-up worked with snake_case on.Tests
db-casing.test.ts: D1 (Miniflare, inside a request and outside it viacreatePrimaryDb), PGlite, and fake MySQL hit snake_case columnscreated_at; config writer emitscasingplugin-vite-environment.test.ts: Pages, class A (TanStack Start) and class B (SvelteKit) apps read casing from the configvoid prepareagrees with the plugin ondb.d.tsmain's source, 36 of these tests fail; with the change, all 482 pass.check:sdk(12/12),check:platform(7/7),vp fmt --check,vp lint, and 38 db/deploy/config/inference unit files (642 tests) all pass.void db generate/migrate/seed/push, deploy drift check) showed snake_case columns in D1 (PRAGMA table_info).Docs:
docs/guide/database.md(Column casing) anddocs/reference/config.md.🤖 Generated with Claude Code