Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems using Model with relation #14

Closed
jacobaraujo7 opened this issue Sep 6, 2022 · 1 comment
Closed

Problems using Model with relation #14

jacobaraujo7 opened this issue Sep 6, 2022 · 1 comment

Comments

@jacobaraujo7
Copy link
Contributor

schema.prisma example

generator client {
  provider = "prisma-client-dart"
  previewFeatures = ["interactiveTransactions"]
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

enum Role {
  dev
  manager
  admin
}

model Client {
  id                  Int               @id @default(autoincrement())
  createdAt           DateTime          @default(now())
  name                String          
  cnpj                String               
  address             String          
  city                String          
  state               String          
  country             String          
  imageUrl            String?         
  active              Boolean           @default(true)
  projects            Project[]        
}

model User {
  id                  Int               @id @default(autoincrement())
  createdAt           DateTime          @default(now())
  email               String            @unique
  name                String    
  imageUrl            String?   
  active              Boolean           @default(true)
  password            String    
  role                Role              @default(dev)
  project             UserOnProject[]       
}

model Project {
  id                  Int               @id @default(autoincrement())
  createdAt           DateTime          @default(now())
  title               String          
  description         String            @default("")
  imageUrl            String?         
  active              Boolean           @default(true)
  user                UserOnProject[]   
  clientId            Int
  client              Client             @relation(fields: [clientId], references: [id])
}



model UserOnProject {
  user                User              @relation(fields: [idUser], references: [id])
  idUser              Int
  project             Project           @relation(fields: [idProject], references: [id])
  idProject           Int

  @@id([idUser, idProject])
}

The code generator fails to generate and so the json_serializable fails.

image

@Ali1Ammar Ali1Ammar reopened this Sep 6, 2022
@Ali1Ammar
Copy link
Collaborator

this should be fixed for now .
but I will keep this issues open as we need to investigation more in why we need to generate a empty input object at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants