https://www.prisma.io/ logo
Join SlackCommunities
Powered by
# orm-help
  • s

    sid bhatta

    04/12/2019, 7:05 AM
    i_have_this_at_the_moment__I_want_questions_and_answers_to_live_under_category.js
  • j

    James

    04/12/2019, 7:05 AM
    you can see here for more info: https://www.prisma.io/docs/datamodel-and-migrations/datamodel-MYSQL-knul/#relations
  • s

    sid bhatta

    04/12/2019, 7:06 AM
    @James, does the above model works. just started with prisma and it's getting bit tricky for me.
  • j

    James

    04/12/2019, 7:07 AM
    You say you want the question and answer to live under category, great. Then move them to the Category type definition and remove them from the survey definition
  • j

    James

    04/12/2019, 7:08 AM
    I don't entirely understand the logic of how you want to organize it but take this example that might not align perfectly with your desires:
  • s

    sid bhatta

    04/12/2019, 7:09 AM
    i think i got you what you meant. Thanks for the idea
  • s

    sid bhatta

    04/12/2019, 7:10 AM
    or i can paste in the category and question model if you want to have a look
  • s

    sid bhatta

    04/12/2019, 7:11 AM
    each categories will have bunch of questions and questions will have correct answer. what i want to do in my survey model is, i want to be able to group all the questions and answers related to the category
  • s

    sid bhatta

    04/12/2019, 7:12 AM
    Not sure if i am clear enough
  • j

    James

    04/12/2019, 7:12 AM
    I would change the spelling of the types to use singular like "Category" instead of "Categories", but yeah you seem to have gotten the idea of relationships, but you probably don't need question and answer on the survey type
  • j

    James

    04/12/2019, 7:12 AM
    you can then make sure your queries have this kind of grouping in your resolvers
  • s

    sid bhatta

    04/12/2019, 7:12 AM
    thanks @James
  • j

    James

    04/12/2019, 7:13 AM
    defining the datamodel is just types and relations. Then use prisma-client or something else to build an api that queries the relations
  • s

    sid bhatta

    04/12/2019, 7:16 AM
    yeah, i have already got the graphql-yoga setup for querying purpose.. Thanks for your help @James.
  • f

    Fabiano Bonomini

    04/12/2019, 1:55 PM
    Is there any patteen for write better resolvers and write clean code?
    t
    • 2
    • 1
  • n

    Novalis

    04/12/2019, 2:33 PM
    hi 🙂 i just set up prisma, graphql-yoga and postgresql with docker. Also got the postdeploy hooks running, where after deploying the prisma service, the prisma.graphql schema will be refetched and the typescript prisma-client will be regenerated. Now here is my problem (in my personal & my official project with my teammate): GraphQL-yoga imports the schema.graphql, which indeed uses types and inputs from the generated prisma.graphql file, which can only be generated from a running prisma instance with a deployed prisma service. This is fine if you still have an 'old' prisma.graphql file, however deploying the prisma service will only update the generated files on the local computer and not in the docker container. Is there any way to also update the generated files in the docker container without having to install the prisma cli on docker and trigger things from there (we're also looking for a CI/CD solution for our second project)? My first idea would be something like: start docker container (already old prisma.graphql in the project) -> prisma deploy -> get-schema from endpoint -> prisma generate (the typescript prisma-client) -> COPY over the 'generated' folder
    m
    • 2
    • 5
  • a

    aldarund

    04/12/2019, 7:23 PM
    Its not possible to have conditions in where based on 1-1 relations? Why?
  • a

    aldarund

    04/12/2019, 7:26 PM
    E.g.
    Copy code
    type Consultancy {
      id: ID! @id
      organization: Organization @relation(name: "OrganizationConsultancy")
    }
    type Organization {
      id: ID! @id
      consultancy: Consultancy @relation(link: INLINE, name: "OrganizationConsultancy")
    }
    And then i want
    Copy code
    prisma.updateConsultancy({
          data: {
            ...
          },
          where: { organization: {id: id}
        })
    But it seems that generated client have only id in where, without organization
  • a

    aldarund

    04/12/2019, 8:40 PM
    same goes for quering. Ye, i can use query & updatemultiple but thats not right 😞
  • j

    John Aagaard

    04/12/2019, 8:57 PM
    Hello would anyone be able to point me in good direction for documentation on connecting mutations? I have a log that is connected to a template that is connected to a user and having issues. New to this slack channel so not sure what anybody would need to see to help me. I sure do need some help though.
  • n

    Nathan Rice

    04/12/2019, 10:35 PM
    I am trying to set up the prisma-auth example project to use a MongoDB Atlas free-tier db. This is my docker-compose.yml. I've changd my prisma.yml endpoint to http://localhost:4466 as well Could someone help me figure out what I am doing wrong? I keep getting a "could not connect to server at http://localhost:4466" when i try prisma deploy
    -.txt
  • n

    Nathan Rice

    04/12/2019, 10:36 PM
    I checked "docker-compose config" and verified the DBUSER and DBPASS are being substituted properly
  • n

    Nathan Rice

    04/12/2019, 10:40 PM
    I have verified the container is running with "docker ps"
  • n

    Nathan Rice

    04/12/2019, 10:41 PM
    when i "export DEBUG='*'; prisma deploy" i get this:
    j
    • 2
    • 28
  • n

    Nathan Rice

    04/12/2019, 10:43 PM
    docker ps
  • n

    Nathan Rice

    04/12/2019, 10:43 PM
  • p

    Pankaja

    04/13/2019, 1:05 PM
    Hello, I've been working on a project to get familiar with GraphQL and Prima. As for now, I'm using the sample database on prima. The project is a finance app where you can manage your finance. This is sample of my datamodel
    Copy code
    type Wallet {
        id: ID! @unique
        name: String!
        balance: Float! @default(value: "0.0")
        user: User!
    }
    
    type Income {
        id: ID! @unique
        name: String
        createdOn: DateTime!
        value: Float!
        wallet: Wallet!
        category: Category!
        isSettled: Boolean! @default(value: "true")
    }
    
    type Expense {
        id: ID! @unique
        name: String
        createdOn: DateTime!
        value: Float!
        wallet: Wallet!
        category: Category!
        isSettled: Boolean! @default(value: "true")
    }
    This is working so far. However now I need to add a wallet to wallet transfer. So, I tried adding toWallet: Wallet to type Expense and fromWallet to type Income. But when I run prisma deploy, I'm getting an error like this
    Copy code
    `Errors:
    
      Income
        :heavy_multiplication_x: The relation field 'wallet' must specify a '@relation' directive: '@relation(name: "MyRelation")'
        :heavy_multiplication_x: The relation field 'fromWallet' must specify a '@relation' directive: '@relation(name: "MyRelation")'
    
      Expense
        :heavy_multiplication_x: The relation field 'wallet' must specify a '@relation' directive: '@relation(name: "MyRelation")'
        :heavy_multiplication_x: The relation field 'toWallet' must specify a '@relation' directive: 'relation(name: "MyRelation")'
    How can I fix this ? Any help would be appreciated. Thanks
  • a

    ahebwa49

    04/13/2019, 1:46 PM
    Hi team, trying to deploy my backend but i keep being asked for a
    PRISMA_MANAGEMENT_API_SECRET
    as in the image below. How do i go about this?
  • a

    ahebwa49

    04/13/2019, 1:53 PM
  • p

    Prakarsh Gupta

    04/13/2019, 2:25 PM
    Hey everybody, I just started learning graphql-ypga with prisma. I have been through the tutorials so far but there are many things that I still don't understand....I would love it if somebody shared a full crud cheatsheet or something with me!!!
    a
    • 2
    • 1
1...251252253...637Latest