Bug description


How to reproduce
Run prisma generate on this schema:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
// ### Product ###
model Product {
id Int @default(autoincrement()) @id
name String @unique
description String?
developerId Int
developer ProductDeveloper @relation(fields: [developerId], references: [id])
forumId Int?
forum Forum? @relation(fields: [forumId], references: [id])
type ProductType
tags ProductTag[]
salesPages ProductSalesPage[]
productVersions ProductVersions[]
productPictures ProductPictures[]
Customer Customer? @relation(fields: [customerId], references: [id])
customerId Int?
Invoice Invoice? @relation(fields: [invoiceId], references: [id])
invoiceId Int?
owner Seller @relation(fields: [ownerId], references: [id])
ownerId Int
}
enum ProductType {
Plugins_WordPress
Temas_WordPress
}
model ProductDeveloper {
id Int @default(autoincrement()) @id
name String @unique
products Product[]
}
model ProductTag {
id Int @default(autoincrement()) @id
name String @unique
translation String
products Product[] @relation(references: [id])
}
model ProductSalesPage {
id Int @default(autoincrement()) @id
url String @unique
productId Int
product Product @relation(fields: [productId], references: [id])
}
model ProductVersions {
id Int @default(autoincrement()) @id
provider Provider
isCompacted Boolean @default(false)
version String
lastUpdated String?
isUnlocked Boolean @default(false)
warning String?
createdAt DateTime @default(now())
downloadHost downloadHost
downloadHostAccount Int
downloadPath String
productId Int
product Product @relation(fields: [productId], references: [id])
}
model ProductPictures {
id Int @default(autoincrement()) @id
pictureUrl String @unique
productId Int
product Product @relation(fields: [productId], references: [id])
}
// ### User ###
model User {
id Int @default(autoincrement()) @id
name String
email String @unique
login String @unique
balance Float @default(0.00)
isSuspended Boolean @default(false)
suspendedReason String?
createdAt DateTime @default(now())
tags UserTag[] @relation(references: [id])
accounts UserPlatformAccount[]
customer Customer?
seller Seller?
}
model UserPlatformAccount {
id Int @default(autoincrement()) @id
nickname String?
platformUserId String
platform SupportedPlatforms
details Json
userId Int
user User @relation(fields: [id], references: [id])
}
model UserTag {
id Int @default(autoincrement()) @id
value String @unique
users User[] @relation(references: [id])
}
// ### Customer ###
model Customer {
id Int @default(autoincrement()) @id
birthday DateTime?
cpf String? @unique
gender Gender?
createdAt DateTime @default(now())
invoices Invoice[]
product Product[]
userId Int
user User @relation(fields: [userId], references: [id])
// Criar um resolver na API GraphQL para pegar os produtos de acordo com as
// invoices que estão pagas.
}
// ### Seller ###
model Seller {
id Int @default(autoincrement()) @id
role SellerRole
cpf String @unique
createdAt DateTime @default(now())
invoices Invoice[]
product Product[]
userId Int
user User @relation(fields: [userId], references: [id])
}
enum SellerRole {
ADMIN
RESELLER
}
// Global model and enums
model Forum {
id Int @default(autoincrement()) @id
name String
permalink String @unique
parentId Int?
parent Forum? @relation(fields: [parentId], references: [id])
Forum Forum[] @relation("ForumToForum")
product Product?
}
model Host {
id Int @default(autoincrement()) @id
host downloadHost
accountId String
}
model Invoice {
id Int @default(autoincrement()) @id
status InvoiceStatus
transactions PaymentTransaction[]
purchaseDate DateTime
products Product[]
supportExpiration DateTime
customerId Int
customer Customer @relation(fields: [customerId], references: [id])
sellerId Int
seller Seller @relation(fields: [sellerId], references: [id])
}
enum InvoiceStatus {
PAID
OVERDUE
REFUNDED
CANCELLED
}
model PaymentTransaction {
id Int @default(autoincrement()) @id
transactionID Int @unique
platform PaymentTransactionPlatform
date DateTime
details Json
value Float
invoiceId Int
invoice Invoice @relation(fields: [invoiceId], references: [id])
}
enum PaymentTransactionPlatform {
MERCADOPAGO
}
enum Gender {
M
F
}
enum Provider {
GPLZONE
ULTRAPACKV2
}
enum downloadHost {
DROPBOX
}
enum SupportedPlatforms {
FORUM
MERCADOLIBRE
}
Expected behavior
I can generate a Prisma Client.
Environment & setup
- OS: Windows
- Database: -
- Prisma version:
λ prisma -v
Environment variables loaded from ./prisma/.env
@prisma/cli : 2.0.0-beta.8
Current platform : windows
Query Engine : query-engine 12105ee25e61860c17a381ffdfcf2b2513b0ba92 (at C:\ProgramData\nvm\v12.6.0\node_modules\@prisma\cli\query-engine-windows.exe)
Migration Engine : migration-engine-cli 12105ee25e61860c17a381ffdfcf2b2513b0ba92 (at C:\ProgramData\nvm\v12.6.0\node_modules\@prisma\cli\migration-engine-windows.exe)
Introspection Engine : introspection-core 12105ee25e61860c17a381ffdfcf2b2513b0ba92 (at C:\ProgramData\nvm\v12.6.0\node_modules\@prisma\cli\introspection-engine-windows.exe)
Format Binary : prisma-fmt 12105ee25e61860c17a381ffdfcf2b2513b0ba92 (at C:\ProgramData\nvm\v12.6.0\node_modules\@prisma\cli\prisma-fmt-windows.exe)
Bug description
How to reproduce
Run
prisma generateon this schema:Expected behavior
I can generate a Prisma Client.
Environment & setup