GithubHelp home page GithubHelp logo

Make Relation Fields Required about prisma1 HOT 8 CLOSED

prisma avatar prisma commented on August 15, 2024 18
Make Relation Fields Required

from prisma1.

Comments (8)

schickling avatar schickling commented on August 15, 2024 2

Hi @sedubois! This feature is now in beta.

Feel free to ping us in Slack to get access to this new feature.

from prisma1.

marktani avatar marktani commented on August 15, 2024 1

This is now available to everyone. Note that to-many relational fields are always required. If a node is not connected to any nodes in such a relation, it is the empty list [].

You can set a relation to required both in the UI and the schema file.
If you need more information, please consult the forum.

from prisma1.

schickling avatar schickling commented on August 15, 2024

Very good point. This is fairly important!

from prisma1.

sedubois avatar sedubois commented on August 15, 2024

Any news on this front?

from prisma1.

sedubois avatar sedubois commented on August 15, 2024

Thanks great news!

I tried to use this, but I don't see a way to make a relation required through the UI.

I also couldn't make it required through the schema, getting Errors: course: The relation field course cannot be made required, because there are already instances of the enclosing type that violate this constraint.

However, I only have three instances which all three have a proper value for this field.

I think documentation would be helpful for this. @marktani any pointers?

from prisma1.

marktani avatar marktani commented on August 15, 2024

This looks to be an issue with migrating an existing optional relation to a required relation. Here's a bug tracker: https://github.com/graphcool/api-bugs/issues/90.

You need to hover the relation field to enable the selection between required/optional:

image

from prisma1.

sedubois avatar sedubois commented on August 15, 2024

Thanks @marktani. I don't see this required/optional toggle, maybe related to the bug you linked?

Regardless of where I hover with my mouse on this wizard, I don't see this toggle appearing.

screen shot 2017-06-06 at 16 22 52

from prisma1.

marktani avatar marktani commented on August 15, 2024

No, this is a separate bug - could you please create a new issue here?

from prisma1.

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.