Skip to content

Commit

Permalink
fix/prisma-negative-types (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolae-Rares Ailincai authored Apr 25, 2023
1 parent 9445764 commit c2627d6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prisma-mapper",
"version": "1.4.0",
"version": "1.4.1",
"description": "A CLI that adds @Map, @@Map, @updatedAt based on a json or camel case for the prisma schema",
"main": "bin/index.js",
"preferGlobal": true,
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/expected.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ model ModelTwo {
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
someInt Int @map("some_int")
someInt BigInt? @default(-2) @map("some_int")
someUuid String? @map("some_uuid") @db.Uuid
ModelThree ModelThree[]
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/mock.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ model model_two {
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime? @db.Timestamptz(6)
deleted_at DateTime? @db.Timestamptz(6)
some_int Int
some_int BigInt? @default(-2)
some_uuid String? @db.Uuid
model_three model_three[]
Expand Down
2 changes: 1 addition & 1 deletion src/functions/deserialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const handlers = (
.join(', ')}))`;
}

if (typeof value === 'number') {
if (typeof value === 'number' || !Number.isNaN(value)) {
return `@default(${value})`;
}

Expand Down

0 comments on commit c2627d6

Please sign in to comment.