Skip to content
This repository has been archived by the owner on Oct 9, 2022. It is now read-only.

Commit

Permalink
Upgade prisma release to 2.0.0-beta.9
Browse files Browse the repository at this point in the history
  • Loading branch information
michaellzc committed Jun 14, 2020
1 parent 78f2eb2 commit 0bc31bb
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 36 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"lint": "xo --fix"
},
"dependencies": {
"@prisma/cli": "^2.0.0-beta.5",
"@prisma/generator-helper": "^2.0.0-beta.5",
"@prisma/cli": "^2.0.0-beta.9",
"@prisma/generator-helper": "^2.0.0-beta.9",
"@prisma/sdk": "^2.0.0-beta.5",
"arg": "^4.1.3",
"camelcase": "^6.0.0",
Expand Down
8 changes: 5 additions & 3 deletions src/deserializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export interface Field {
isId: boolean;
type: string;
dbNames: string[] | null;
isGenerated: boolean;
isGenerated: boolean;
hasDefaultValue: boolean;
relationFromFields?: any[];
relationToFields?: any[];
relationOnDelete?: string;
Expand Down Expand Up @@ -64,7 +65,8 @@ const handlers = type => {
isUnique: value => value ? '@unique' : '',
dbNames: value => {},
relationToFields: value => {},
relationOnDelete: value => {},
relationOnDelete: value => {},
hasDefaultValue: value => {},
relationName: value => {},
isReadOnly: value => {},
isGenerated: value => {},
Expand Down Expand Up @@ -116,7 +118,7 @@ function handleDbName(dbName: string | null) {

function deserializeModel(model: Model) {
const {name, uniqueFields, dbName} = model;
const fields = model.fields as Field[];
const fields = model.fields as unknown as Field[];

const output = `
model ${name} {
Expand Down
2 changes: 1 addition & 1 deletion src/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function transformModel(model: Model) {
});

const fixFieldsName = produce(fixModelName, draftModel => {
const fields = draftModel.fields as Field[];
const fields = draftModel.fields as unknown as Field[];
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
draftModel.fields = fields.map(field => produce(field, draftField => {
const {name, kind, type, relationFromFields, relationToFields, isList} = draftField;
Expand Down
50 changes: 25 additions & 25 deletions test/snapshots/deserializer.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@ Generated by [AVA](https://avajs.dev).
`␊
model User {␊
id String @id @default(cuid()) ␊
email String @unique ␊
name String? ␊
id String @id @default(cuid()) ␊
email String @unique
name String?
posts Post[] @relation(name: "PostToUser")␊
like Like[] @relation(name: "LikeToUser")␊
}␊
model Post {␊
id String @id @default(cuid()) ␊
createdAt DateTime @default(now()) ␊
updatedAt DateTime @updatedAt␊
published Boolean ␊
title String ␊
content String? ␊
authorId String? ␊
id String @id @default(cuid()) ␊
createdAt DateTime @default(now()) ␊
updatedAt DateTime @updatedAt␊
published Boolean
title String
content String?
authorId String?
author User? @relation(name: "PostToUser", fields: [authorId], references: [id])␊
like Like[] @relation(name: "LikeToPost")␊
}␊
model Like {␊
id String @id @default(cuid()) ␊
userId String ␊
id String @id @default(cuid()) ␊
userId String
user User @relation(name: "LikeToUser", fields: [userId], references: [id])␊
postId String ␊
postId String
post Post @relation(name: "LikeToPost", fields: [postId], references: [id])␊
@@unique([userId, postId])␊
Expand All @@ -49,25 +49,25 @@ Generated by [AVA](https://avajs.dev).
`␊
model Post {␊
id Int @id @default(autoincrement()) ␊
title String ␊
content String? ␊
published Boolean @default(false) ␊
id Int @id @default(autoincrement()) ␊
title String
content String?
published Boolean @default(false) ␊
author User @relation(name: "postsTousers", fields: [authorId], references: [id])␊
authorId Int @map("author_id")␊
createdAt DateTime @default(now()) @map("created_at")␊
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")␊
authorId Int @map("author_id")␊
createdAt DateTime @default(now()) @map("created_at")␊
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")␊
@@map("posts")␊
}␊
model User {␊
id Int @id @default(autoincrement()) ␊
email String @unique ␊
weight Float ␊
id Int @id @default(autoincrement()) ␊
email String @unique
weight Float
posts Post[] @relation(name: "postsTousers")␊
createdAt DateTime @default(now()) @map("created_at")␊
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")␊
createdAt DateTime @default(now()) @map("created_at")␊
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")␊
@@map("users")␊
}`
Binary file modified test/snapshots/deserializer.ts.snap
Binary file not shown.
27 changes: 22 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,17 @@
"@nodelib/fs.scandir" "2.1.3"
fastq "^1.6.0"

"@prisma/cli@^2.0.0-beta.5":
version "2.0.0-beta.5"
resolved "https://registry.yarnpkg.com/@prisma/cli/-/cli-2.0.0-beta.5.tgz#9116e9ba08131fce47bb96d9bc19e8a443a2b893"
integrity sha512-Kl3IqOq6sYdajnLA034SLJxFCB0IxXcrSLYR8W9XTOyt3RRP/TCUPp5yBVfO9B21Kwe9YrFujTbSD2qQaDg1QA==
"@prisma/cli@^2.0.0-beta.9":
version "2.0.0-beta.9"
resolved "https://registry.yarnpkg.com/@prisma/cli/-/cli-2.0.0-beta.9.tgz#b6b1651f8a54bd93dd015f356ea43fc3e1ed21cb"
integrity sha512-RN5SHWxguGdEcRl3eVur4ehsiI3Ra6Z0gtIKtF0laqfmQj0fgTAoT5ipWU8jOWAZA1FmSYCTfhZ5e1TOJscBUw==

"@prisma/debug@2.0.0-beta.9":
version "2.0.0-beta.9"
resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-2.0.0-beta.9.tgz#2da4acf7bd78f0dcb19ed7014d9c1cd8b28a0112"
integrity sha512-OVm3Ufp7cCeM63FB1s/D6Ga2dHzHMEeQQJIEuFOv9A+PhGrSFfCaO3MdkspDCAgwtaBP2vhcRs0bsQHp2eE4jA==
dependencies:
debug "^4.1.1"

"@prisma/engine-core@2.0.0-beta.5":
version "2.0.0-beta.5"
Expand Down Expand Up @@ -122,7 +129,7 @@
rimraf "^3.0.2"
tempy "^0.5.0"

"@prisma/generator-helper@2.0.0-beta.5", "@prisma/generator-helper@^2.0.0-beta.5":
"@prisma/generator-helper@2.0.0-beta.5":
version "2.0.0-beta.5"
resolved "https://registry.yarnpkg.com/@prisma/generator-helper/-/generator-helper-2.0.0-beta.5.tgz#d1103eb4e07072ab4d843319249938b9968d211d"
integrity sha512-pL25Wn7ybVrw74PI/smiNkKFhE/mVvHZsGCVq9sQxEJMV5KkCnb6DmWdE5EWsO5oiZpF74vgoV4XEZY9DGSscw==
Expand All @@ -133,6 +140,16 @@
debug "4.1.1"
isbinaryfile "^4.0.6"

"@prisma/generator-helper@^2.0.0-beta.9":
version "2.0.0-beta.9"
resolved "https://registry.yarnpkg.com/@prisma/generator-helper/-/generator-helper-2.0.0-beta.9.tgz#5d3b430423629cf0f77b7a3f38528d709227041c"
integrity sha512-nn0u0SPP+EAQ5raOLBXnpeFG6YhxSECi/B1EmU8vAfBbcGpuHKtzZO0QxPvz94gcBeqqy8ubc5vkOJ2soEor/g==
dependencies:
"@prisma/debug" "2.0.0-beta.9"
"@types/cross-spawn" "^6.0.1"
chalk "^3.0.0"
cross-spawn "^7.0.2"

"@prisma/get-platform@2.0.0-beta.5":
version "2.0.0-beta.5"
resolved "https://registry.yarnpkg.com/@prisma/get-platform/-/get-platform-2.0.0-beta.5.tgz#8798ad177684255326d3630348ea237664508224"
Expand Down

0 comments on commit 0bc31bb

Please sign in to comment.