Giter Site home page Giter Site logo

Comments (8)

jasonkuhrt avatar jasonkuhrt commented on August 10, 2024 1

I just hit this issue tonight and Google'd my way here.

model User {
  id       String @id @default(cuid())
  mother   User?
  father   User?
  children User[]
}

I expected this to just work. Naively maybe :)

I can make the error go away by:

model User {
  id       String @id @default(cuid())
  mother   User?  @relation("mother")
  father   User?  
  children User[] @relation("mother")
}

or

model User {
  id       String @id @default(cuid())
  mother   User?  
  father   User?  @relation("father")
  children User[] @relation("father")
}

But this doesn't make sense to me.

from prisma-engines.

mavilein avatar mavilein commented on August 10, 2024

Hey @yovanoc ,

thanks for reaching out! 🙏 Can you please answer the following questions:

  1. What's your full Datamodel?
  2. What version of the VS Code Plugin are you using?

from prisma-engines.

yovanoc avatar yovanoc commented on August 10, 2024

No problem @mavilein !

Here's the datamodel: https://gist.github.com/yovanoc/ca47e5fb738bfeb52cb37ef2cb07b1c3

And I don't know how to see the plugin version but It's surely the latest, even if I remove and install again. But I want to say thats not only in vscode:

image

from prisma-engines.

yovanoc avatar yovanoc commented on August 10, 2024

PS: It only appear when I uncomment the two last self references

from prisma-engines.

mavilein avatar mavilein commented on August 10, 2024

Ah thanks for the file. So the problem is that it is reported at the wrong location. You have to write your datamodel like this to fix that:

model CelestisInstance {
  id          CUID
  ...
  boundDaemonInstance    CelestisInstance? @relation(name: "MyRelation")
  boundTerminalInstances CelestisInstance[] @relation(name: "MyRelation")
}

You need to specify this like that because we need to know if those fields belong to the same relation or two different relations. I will make myself a note to make this clearer with a suggestion.

from prisma-engines.

yovanoc avatar yovanoc commented on August 10, 2024

Oh that was my fault, so the "MyRelation" mean that is a self model relation??

from prisma-engines.

janpio avatar janpio commented on August 10, 2024

(This spawned an issue by @schickling in specs: prisma/specs#213)

from prisma-engines.

yoshuawuyts avatar yoshuawuyts commented on August 10, 2024

Talked about this in triage today, this should be fixed.

from prisma-engines.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.