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

    signor_busi

    10/07/2018, 12:23 PM
    eg. can i do a "primsa reset" or "prisma deploy" programmatically from within my node application?
  • s

    signor_busi

    10/07/2018, 12:24 PM
    I'm setting up integration tests for my project and i would like to do a prisma deploy and prisma reset before running the tests
  • j

    Joellao

    10/07/2018, 1:48 PM
    Hello to everybody, catched a weird behaviour in Playground. So this is my query
    Copy code
    query{
      feed{
        description,
        imageURLs{
          url
        }
      },
      me{
        posts{
          imageURLs{
            url
          }
        }
      }
    }
    The imageURLs produces two different outputs, in the
    feed
    tree it comes out as
    null
    in the
    me
    tree under
    posts
    comes out like
    []
    . Now
    feed
    is declared as
    [Post!]!
    and
    me
    is declared as
    User
    which has
    [Post!]
    . Now I would need to get the empty array if there is no data and not null. Like changed a bunch of things but always the same result
    n
    • 2
    • 1
  • s

    shashank

    10/07/2018, 3:32 PM
    I am planning to deploy prisma Service in AWS and I saw the documentation for mysql https://www.prisma.io/docs/tutorials/deploy-prisma-servers/aws-fargate-joofei3ahd#2.-deploying-a-prisma-server-to-fargate
  • s

    shashank

    10/07/2018, 3:33 PM
    Should I follow and modify config to deploy with postgres ? Will it work with existing postgres as well ?
  • g

    Greyson

    10/07/2018, 3:59 PM
    Hey, so maybe this is just a general GraphQL question, but I'm trying to do some basic relations with Prisma. The relation is as follows: There is a table that stores Users and a table that stores Vehicles. A single Vehicle can belong to many Users, and each User can configure things like the display name of that Vehicle. So my schema looks like this:
    Copy code
    type User {
      id: ID! @unique
      ...
      assets: [UserAsset!]! @relation(name: "UserToAsset", onDelete: CASCADE)
    }
    
    type Asset {
      assetId: String! @unique
      assetType: AssetType
      users: [UserAsset!]! @relation(name: "AssetToUser", onDelete: CASCADE)
    }
    
    type UserAsset {
      user: User! @relation(name: "UserToAsset")
      asset: Asset! @relation(name: "AssetToUser")
      name: String!
      ...
    }
    Is this the proper way to go about something like this?
    n
    • 2
    • 1
  • b

    bwoodlt

    10/07/2018, 4:37 PM
    graphql-yoga
    question: Are there any commands to fully shutdown the server in
    graphql-yoga
    , for example if I'm trying to reload onSave() and needs the server to reloads also?
  • g

    Greyson

    10/07/2018, 7:08 PM
    Anyone know the progress of this issue? https://github.com/prisma/prisma/issues/1936
    n
    • 2
    • 1
  • g

    Greyson

    10/07/2018, 8:13 PM
    Also, has anyone had any success in creating a datamodel that supports authentication for accounts with sub-accounts?
  • r

    rick

    10/08/2018, 9:47 AM
    is it me or do none of the links in the 4 panels on this page work: https://www.prisma.io/docs/get-started/04-explore-features-f001/
    a
    n
    • 3
    • 3
  • r

    rick

    10/08/2018, 9:47 AM
    left hand side nav seems fine
  • s

    Sach97

    10/08/2018, 1:19 PM
    Hi everyone, since I've cleaned my docker volumes with docker rm volume, my code doesn't work anymore. Doesn't feel normal, anyone else experienced this issue ?
    m
    n
    • 3
    • 13
  • g

    Greyson

    10/08/2018, 2:12 PM
    So, can someone explain something to me? When using Prisma bindings with my GrahpQLServer, do I have to replicate any and all Prisma mutations/queries that I want in my own resolver methods? I see that I can access the data in Prisma fro my Typescript code, but it seems redundant to replicate everything Prisma has already done
  • g

    Greyson

    10/08/2018, 2:28 PM
    @nilan Figure you may know better than most ^
  • j

    Joellao

    10/08/2018, 3:21 PM
    Do you guys know when other query aggregations will come in prisma? I need to have like an AVG of all the rates a topic has and show it and wanted to do it from the server without using resource on the client to calculate it since i'm working on a mobile app. Was messing around and thought on something like this
    Copy code
    getUserRateAverage(parent, args, ctx, info) { 
        let rates = ctx.db.query.rates({}, info);
        let sum = 0;
        for (let i = 0; i < rates.length; i++) {
          sum += rates[i];
        }
    
        return rates.length != null ? sum / rates.length : 0;
      },
    but don't know if this is even legit hahahaha, really new with GraphQL and Prisma. Let me know!
  • s

    stearm

    10/08/2018, 3:21 PM
    Hi! How can I fix this:
    java.lang.RuntimeException: ProjectHelper: Could not resolve project with id: project-name@default
    ? I just restarted my docker project and it doesnt start anymore 😞
    d
    • 2
    • 1
  • j

    Joseph Carrington

    10/08/2018, 6:50 PM
    Hey folks. Let’s say I an using the enw prisma-client, and have a resolverMap like so:
    Copy code
    Query: {
        async cart(obj, args, context, info) {
          const { user_id } = await getUserFromAuthorizationHeader(
            context.authorization
          );
          const cart = await prisma.portalCart({owner: user_id});
          return cart;
        }
      }
    }
    Cart: {   
      async items(obj, args, context, info) {
          const items = await prisma.portalCart({ owner: obj.owner }).items();
          return items;
       }
    }
    is that
    await prisma.portalCart({ owner: obj.owner }).items()
    using a cached version of portalCart, or is it having to fetch it again? If so, Is there a way to get both the cart AND it’s items? What I am trying to avoid is having to do two different queries for prisma.cart() if I can avoid it.
    h
    • 2
    • 2
  • j

    Joseph Carrington

    10/08/2018, 10:07 PM
    When I run prisma deploy after doing a rename directive, I get stuck on
    Applying changes (3/2)
    for about ten minutes, until I get an error that my token expired. Does that mean the CLI is mistakenly attempting to apply change three of two, and if so, is it safe to to assume that my rename succeeded?
  • j

    Joseph Carrington

    10/08/2018, 10:09 PM
    it seems like no
  • a

    aroman

    10/09/2018, 1:19 AM
    Hi 🙂 I imported
    User
    type into my schema.graphql. When ever I try to for example query as such:
    const user = await ctx.db.user({ email });
    . I log out
    user.password
    and it returns
    undefined
    . The User object returns only:
    Copy code
    { middleName: 'vic',
      email: 'test@test',
      lastName: 'Roman',
      firstName: 'Alejandro',
      id: 'cjmzgzmgc000708611vn6klyw' }
    but it is missing role and password. I am trying to plug use bcrypt's compare function, but it wont work since the arguments
    user.password
    returns as undefined. Would anyone happen to be able to point me in the right direction
  • y

    yolen

    10/09/2018, 9:00 AM
    I found a small typo in the fargate tutorial https://www.prisma.io/tutorials/deploy-prisma-to-aws-fargate-ct14/. Where should I report it?
    n
    • 2
    • 2
  • e

    ejoebstl

    10/09/2018, 9:17 AM
    Hello there, I'm currently evaluating to move a project to prisma. A thing I'm not sure about: Is it possible to map nested GraphQL queries to a single SQL query?
  • s

    siyfion

    10/09/2018, 10:48 AM
    @ejoebstl Yes
  • s

    siyfion

    10/09/2018, 10:49 AM
    In short, if you pass the
    info
    argument through from the query to the Prisma binding, it’ll sort it all out into one SQL query
  • e

    ejoebstl

    10/09/2018, 10:59 AM
    Thank you! What if the API schema does not match the DB schema 1:1? Can I still provide a custom SQL query for some parts of the GraphQL schema?
    n
    • 2
    • 4
  • y

    yolen

    10/09/2018, 11:35 AM
    I managed to get up and running on as fargate using the tutorial. However, cloudformation and fargate is too complex for me so I was considering doing something simpler (less scalable etc). Is it a good idea to run (prisma and service) on an ec2 instance using docker-compose and docker-machine connected to an aws mysql db?
  • e

    ejoebstl

    10/09/2018, 11:46 AM
    @yolen What's your issue with fargate? Fargate IS essentially docker-compose, with the EC2 instance hidden.
  • y

    yolen

    10/09/2018, 11:47 AM
    two things 🙂 1) I cannot run cloudformation locally? 2) I understand docker compose but cannot really say that about cloudformation 🙂 too many knobs and complexity for my tiny brain
  • e

    ejoebstl

    10/09/2018, 11:50 AM
    Yes, you cannot run cloudformation (or any part of AWS) locally. But you can have a look at the task definition in the template: https://github.com/prisma/prisma-templates/blob/master/aws/fargate.yml#L233
  • e

    ejoebstl

    10/09/2018, 11:50 AM
    That maps almost 1:1 to a docker compose file.
1...132133134...637Latest