Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@onmax
Copy link
Contributor

@onmax onmax commented Dec 17, 2025

Fixes #727

Problem

MySQL drizzle requires mode: 'default' | 'planetscale' when using schema with relational queries. The config option was being ignored.

Generated code before:

const db = drizzle({ connection: {...}, schema })

Generated code after:

const db = drizzle({ connection: {...}, schema, mode: 'default' })

Reproduction

git clone --depth 1 --filter=blob:none --sparse https://github.com/onmax/repros.git
cd repros && git sparse-checkout set nuxthub-727
cd nuxthub-727 && MYSQL_URL="mysql://test:test@localhost/test" pnpm install && MYSQL_URL="mysql://test:test@localhost/test" pnpm nuxi prepare

# Check .nuxt/hub/db.mjs - missing mode parameter
cat .nuxt/hub/db.mjs

Verify fix

cd repros && git sparse-checkout add nuxthub-727-fixed
cd nuxthub-727-fixed && MYSQL_URL="mysql://test:test@localhost/test" pnpm install && MYSQL_URL="mysql://test:test@localhost/test" pnpm nuxi prepare

# Check .nuxt/hub/db.mjs - now includes mode: 'default'
cat .nuxt/hub/db.mjs

The -fixed folder includes a pnpm patch with the fix.

Other solutions:

  • We could create a discriminated type so that the new type only appears for mysql, but I think this might be overcomplicating things.
  • Alternatively, we could add a new dialect called planetscale, which is an alias for mysql with the required mode. However, this goes against the Drizzle config.

@vercel
Copy link

vercel bot commented Dec 17, 2025

@onmax is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@atinux atinux merged commit 7a30fd7 into nuxt-hub:main Dec 17, 2025
7 of 9 checks passed
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.

[BUG] MySQL drizzle client missing 'mode' parameter causes "You need to specify mode" error

2 participants