Skip to content

fix: 'db generate' argument parsing - #935

Merged
atinux merged 2 commits into
nuxt-hub:mainfrom
Rahiem8855:fix-generate-args-parsing
Oct 19, 2026
Merged

atinux merged 2 commits into
nuxt-hub:mainfrom
Rahiem8855:fix-generate-args-parsing

Conversation

@Rahiem8855

@Rahiem8855 Rahiem8855 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

For some reason I'd get the following error when running npx nuxt db generate --name bingus:

node ➜ /workspaces/treat-tracker (hub) $ npx nuxt db generate --name bingus
ℹ Ensuring database schema is generated...                                                                                                                                                 4:28:24 PM
ℹ Generating database migrations...                                                                                                                                                        4:28:26 PM
ExecaError: Command failed with exit code 1: drizzle-kit generate '--config=./.nuxt/hub/db/drizzle.config.ts --name=bingus'

/workspaces/treat-tracker/.nuxt/hub/db/drizzle.config.ts --name=bingus file does not exist
    at getFinalError (file:///workspaces/treat-tracker/node_modules/@nuxthub/core/node_modules/execa/lib/return/final-error.js:6:9)
    at makeError (file:///workspaces/treat-tracker/node_modules/@nuxthub/core/node_modules/execa/lib/return/result.js:108:16)
    at getAsyncResult (file:///workspaces/treat-tracker/node_modules/@nuxthub/core/node_modules/execa/lib/methods/main-async.js:168:4)
    at handlePromise (file:///workspaces/treat-tracker/node_modules/@nuxthub/core/node_modules/execa/lib/methods/main-async.js:151:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
    at async Object.run (file:///workspaces/treat-tracker/node_modules/@nuxthub/core/cli/commands/db/generate.mjs:53:24)
    at async runCommand (file:///workspaces/treat-tracker/node_modules/citty/dist/index.mjs:228:47)
    at async runCommand (file:///workspaces/treat-tracker/node_modules/citty/dist/index.mjs:217:5)
    at async runMain (file:///workspaces/treat-tracker/node_modules/citty/dist/index.mjs:394:10) {
  shortMessage: "Command failed with exit code 1: drizzle-kit generate '--config=./.nuxt/hub/db/drizzle.config.ts --name=bingus'",
  command: 'drizzle-kit generate --config=./.nuxt/hub/db/drizzle.config.ts --name=bingus',
  escapedCommand: "drizzle-kit generate '--config=./.nuxt/hub/db/drizzle.config.ts --name=bingus'",
  cwd: '/workspaces/treat-tracker',
  durationMs: 212.489129,
  failed: true,
  timedOut: false,
  isCanceled: false,
  isGracefullyCanceled: false,
  isTerminated: false,
  isMaxBuffer: false,
  isForcefullyTerminated: false,
  exitCode: 1,
  stderr: '/workspaces/treat-tracker/.nuxt/hub/db/drizzle.config.ts --name=bingus file does not exist',
  stdio: [
    undefined,
    undefined,
    '/workspaces/treat-tracker/.nuxt/hub/db/drizzle.config.ts --name=bingus file does not exist'
  ],
  ipcOutput: [],
  pipedFrom: []
} 

After doing some research, i found that the string interpolation in cli/commands/db/generate.mjs gets a bit... quirky. I studied the execa docs, and adjusted the way we entwine/propagate the --custom and --name arguments into the drizzle-kit generate command.

I ended up using a combination of patterns from the execa execution docs. Now the command arguments seem to work as intended:

node ➜ /workspaces/treat-tracker (hub) $ npx nuxt db generate --name bingus
ℹ Ensuring database schema is generated...                                                                                                                                                 4:44:13 PM
ℹ Generating database migrations...                                                                                                                                                        4:44:16 PM
Reading config file '/workspaces/treat-tracker/.nuxt/hub/db/drizzle.config.ts'
[✓] Your SQL migration ➜ server/db/migrations/sqlite/20261003164416_bingus/migration.sql 🚀
✔ Database migrations generated successfully.                                                                                                                                              4:44:16 PM
ℹ Run npx nuxt dev or run npx nuxt db migrate to apply the migrations.
node ➜ /workspaces/treat-tracker (hub) $ npx nuxt db generate --custom
ℹ Ensuring database schema is generated...                                                                                                                                                 4:48:17 PM
ℹ Generating database migrations...                                                                                                                                                        4:48:19 PM
Reading config file '/workspaces/treat-tracker/.nuxt/hub/db/drizzle.config.ts'
Prepared empty file for your custom SQL migration!
[✓] Your SQL migration ➜ server/db/migrations/sqlite/20261003164819_colorful_firebrand/migration.sql 🚀
✔ Database migrations generated successfully.                                                                                                                                              4:48:19 PM
ℹ Run npx nuxt dev or run npx nuxt db migrate to apply the migrations.                                                                                                                     4:48:19 PM
node ➜ /workspaces/treat-tracker (hub) $ npx nuxt db generate --custom --name bingus3
ℹ Ensuring database schema is generated...                                                                                                                                                 4:48:32 PM
ℹ Generating database migrations...                                                                                                                                                        4:48:34 PM
Reading config file '/workspaces/treat-tracker/.nuxt/hub/db/drizzle.config.ts'
Prepared empty file for your custom SQL migration!
[✓] Your SQL migration ➜ server/db/migrations/sqlite/20261003164835_bingus3/migration.sql 🚀
✔ Database migrations generated successfully.                                                                                                                                              4:48:35 PM
ℹ Run npx nuxt dev or run npx nuxt db migrate to apply the migrations.           

@vercel

vercel Bot commented Oct 3, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@atinux atinux changed the title Fix 'db generate' argument parsing fix: 'db generate' argument parsing Oct 19, 2026
@atinux
atinux merged commit 05f3697 into nuxt-hub:main Oct 19, 2026
1 of 2 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.

2 participants