-
Notifications
You must be signed in to change notification settings - Fork 95
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
When using NuxtHub Database with MySQL (hub.db: 'mysql'), the generated drizzle client doesn't include the required mode parameter, causing the error:
You need to specify "mode": "planetscale" or "default" when providing a schema. Read more: https://orm.drizzle.team/docs/rqb#modes
Reproduction
- Configure NuxtHub with MySQL:
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@nuxthub/core'],
hub: {
db: {
dialect: 'mysql',
mode: 'default', // This is ignored
},
},
})- Create a schema in server/db/schema.ts
- Try to use import { db } from 'hub:db'
- Error appears
Root Cause
In
Line 77 in a64584c
| case 'mysql': { |
The generated code:
const db = drizzle({ connection: {...}, schema })
Should be:
const db = drizzle({ connection: {...}, schema, mode: 'default' })
Expected Behavior
The mode option from hub.db.mode should be passed to the drizzle constructor for MySQL connections.
Environment
- @nuxthub/core: 0.10.2
- drizzle-orm: 0.45.1
- Database: MySQL/MariaDB (non-PlanetScale)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working