Skip to content

Commit

Permalink
fix(cli): Support passing numeric args to prisma (#11948)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe authored Feb 6, 2025
1 parent e9d938d commit 1f952b7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/cli/src/commands/prismaHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ export const handler = async ({ _, $0, commands = [], ...options }) => {
for (const [name, value] of Object.entries(options)) {
// Allow both long and short form commands, e.g. --name and -n
args.push(name.length > 1 ? `--${name}` : `-${name}`)
if (typeof value !== 'boolean') {
if (typeof value === 'string') {
// Make sure options that take multiple quoted words
// like `-n "create user"` are passed to prisma with quotes.
value.split(' ').length > 1 ? args.push(`"${value}"`) : args.push(value)
} else if (typeof value === 'number') {
args.push(value)
}
}

Expand Down

0 comments on commit 1f952b7

Please sign in to comment.