Bug description
I'm trying to create a new record in an SQLite table where one of the fields is of type Decimal. If I pass a negative number as string to create function, I get the following error from Prisma:
Argument initialBalance: Got invalid value '-65.7' on prisma.createOneCashBox. Provided String, expected Decimal.
It works if I pass it the same value as number or Decimal. Positive string values also work without any problems.
How to reproduce
Steps to reproduce the behavior:
- Define a table with
Decimal field.
- Try to pass a negative
string value when creating a new record in this table (e.g. -65.7).
- See error in the output.
Expected behavior
The input type looks like this:
export interface CashBoxCreateInput {
...
initialBalance: Decimal | number | string
...
}
So I would assume Prisma should be able to process any numeric value entered as either string, number or Decimal when creating a new record with Decimal field.
Prisma information
generator client {
provider = "prisma-client-js"
previewFeatures = ["nativeTypes"]
}
datasource db {
provider = "sqlite"
url = "file:../myfile.db"
}
model CashBox {
id Int @default(autoincrement()) @id
...
initialBalance Decimal
...
}
Environment & setup
- OS: Manjaro Linux
- Database: SQLite
- Node.js version: 15.6.0
- Prisma version: 2.16.0
Bug description
I'm trying to create a new record in an SQLite table where one of the fields is of type
Decimal. If I pass a negative number asstringto create function, I get the following error from Prisma:It works if I pass it the same value as
numberorDecimal. Positivestringvalues also work without any problems.How to reproduce
Steps to reproduce the behavior:
Decimalfield.stringvalue when creating a new record in this table (e.g.-65.7).Expected behavior
The input type looks like this:
So I would assume Prisma should be able to process any numeric value entered as either
string,numberorDecimalwhen creating a new record withDecimalfield.Prisma information
Environment & setup