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

    pllumh

    12/15/2018, 3:07 PM
    h
    d
    • 3
    • 3
  • i

    Ivan

    12/15/2018, 5:06 PM
    Hi everybody, from the terminal, I can’t login correctly using
    prisma login
    . When I launch the command, the browser opens correctly but when I click to grant permission, a red box like the one in the image pops up and can’t go ahead. I’ve installed prisma globally an I’ve also tried to install the beta version, but nothing seems to work. I’m working on Ubuntu 18. Do you have any idea how to fix this? Thanks!
    d
    • 2
    • 1
  • c

    CCBCodeMonkey

    12/16/2018, 5:37 AM
    can you only use prisma cloud with heroku right now?
  • c

    CCBCodeMonkey

    12/16/2018, 5:44 AM
    (aside from the demo servers)
  • c

    CCBCodeMonkey

    12/16/2018, 5:48 AM
    actually I think I see how it works, you can set up a server and connect it
  • j

    jamiehalvorson

    12/16/2018, 12:07 PM
    Hey, is it possible to connect multiple servers (probably graphql-yoga) to a single prisma instance? Opened up a topic in the forum: https://www.prisma.io/forum/t/multiple-servers-with-one-instance-of-prisma/5379
  • s

    Sean Urgel

    12/16/2018, 4:04 PM
    Hi guys, new to prisma - so sorry if this question sounds stupid. So Prisma takes the model of your database and turns it into a graphql server right? But you don't want to expose all the methods and you maybe have some custom stuff so you install
    graphql-yoga
    right? I know how to do this all locally but I don't know where and how to deploy it?
    w
    • 2
    • 8
  • v

    Vadim

    12/16/2018, 8:29 PM
    Hi all! Could anybody tell me, why Prisma doesn't support property totalCount for pagination (as like this https://graphql.org/learn/pagination/#complete-connection-model)?
    w
    • 2
    • 6
  • d

    dot

    12/16/2018, 10:00 PM
    Hi all, does anyone know how i can access my database when i setup prisma with docker on my local machine
    v
    n
    • 3
    • 15
  • b

    Bailey McKay

    12/17/2018, 4:46 AM
    Hi all, I'm new to coding and to Graphql, but I've been really liking it and Prisma. I had no problem with hard-coded queries, but now I'm trying to softcode some reusable filtering components and I'm finding that coding the shape of the WHERE statements is a bit challenging (I want to expose filtering on joins, reference lists, etc.). The idea is to have them accept arrays and strings of filter values and output the appropriate WHERE statements for the queries. I have ideas about how I might solve this, but I'm thinking this must have been done a thousand times before by now. Are there references or packages that address this? I could see this being a common problem, but I haven't been able to find much on it. Thanks in advance for any help--I really appreciate it.
  • d

    Daniel Dosen

    12/17/2018, 7:25 AM
    In a couple of presentations over the past year, @schickling mentioned an idea of apps built with a "Layered Service Architecture" based on Graphql and microservices. Are there any sample apps showing off that architecture? I'd just like to see a simple example stitching two micro-services together... Thanks for any info!
    l
    • 2
    • 1
  • a

    Ardin

    12/17/2018, 2:31 PM
    What database works best with Prisma? Hi everyone. I’m pretty new to all this and am creating a personal project that I hope to deploy to production. What database would you use with Prisma for a fairly simple app with light traffic.
    d
    • 2
    • 2
  • t

    Tracy

    12/17/2018, 3:03 PM
    Hey! Could someone point me in the direction of some docs on how to use the prisma client on a graphql server? Most of the things I found were about generating it and calling it from a script. Is it this article (https://www.prisma.io/docs/1.22/get-started/03-build-graphql-servers-with-prisma-JAVASCRIPT-e001/) and then I need to manually write all of the resolvers?
    n
    • 2
    • 5
  • s

    serum

    12/17/2018, 3:24 PM
    I need to store images in my DB, and I'd like to be able to query their urls. is there a recommended way to do this using prisma? I couldn't find any info on this in the docs, unfortunately
    d
    a
    • 3
    • 4
  • r

    roderik

    12/17/2018, 6:27 PM
    hi!
  • r

    roderik

    12/17/2018, 6:28 PM
    do you know if there is way to define scalar types in the prisma schema?
  • a

    aman06

    12/17/2018, 7:33 PM
    anyone here know of an easy way to convert a JSON payload into a graphql schema? the payload has a bunch of nested values so it would have to generate types for all of them
  • g

    geabenitez

    12/17/2018, 9:11 PM
    Hello guys, I just tried to install prisma globally with both (yarn and npm) but when I try to use prisma I get: bash: prisma: command not found, asny ide what can I do?
    f
    • 2
    • 14
  • f

    faure

    12/17/2018, 10:30 PM
    Hi everyone, where can I find docs regarding fragments for prisma-binding?
  • f

    faure

    12/17/2018, 10:30 PM
    I have this issue: https://github.com/prisma/prisma-binding/issues/194
  • f

    faure

    12/17/2018, 10:31 PM
    And I can't find an example of fragment usage.
  • j

    Josh

    12/17/2018, 10:48 PM
    I have a datamodel where a user can have none or many "SecondaryLanguages". Currently I'm representing this in my datamodel as
    secondaryLanguages: [Language!] @relation(name: "SecondaryLanguages")
    This doesn't seem to be the right way as I can't insert a user without a secondaryLanguage. Is there a way to change this line in my datamodel that would fit the scenario (none to many secondary languages)?
  • j

    Josh

    12/17/2018, 10:51 PM
    Nevermind, bug in my code
  • z

    Zach Hammer

    12/18/2018, 12:09 AM
    hey all, i posted a PR to fix some logic for checking if headers are empty in the graphql-playground-react
    INJECT_HEADERS
    resolver https://github.com/prisma/graphql-playground/pull/916
  • m

    muhajir

    12/18/2018, 6:27 AM
    Hey guys, suppose I have data model like this.
    Copy code
    type User {
      id: ID! @unique
      authorId: String! @unique
      name: String!
      messages: [Message!]!
    }
    
    type Message {
      id: ID! @unique
      content: String
      author: User!
    }
    Suppose I have this message data in this form
    Copy code
    // example message data
     {
      authorId: 'some-id",
      content: "some content"
    }
    I want to record that message in database. And create new user with that authorId, if it doesn't exist yet.
    Copy code
    async function recordMessage(message) {
      const userExists = await prisma.$exists.user({
          authorId: data.authorId
        });
    
      if (!userExists) {
        await prisma.createAuthor({
          authorId: data.authorId
        })
      }
    
      prisma.createMessage({
        content: data.content,
        author: {
          connect: {
            authorId: data.authorId
          }
        }
      });
    }
    Sometime one message and another message have same
    authorId
    . That's why I check
    userExist
    first. But, when I run recordMessage(message), alot of times. Sometime it result in race condition, it says user doesn't exist yet. But when we're creating new author, I got
    Unique constraint
    Error. Which means there's already user with that
    authorId
    right? How do you guys handle this situation? Is there any plan in the future for something like this:
    Copy code
    prisma.findOrCreateAuthor({
         authorId: "some-id"
    })
    Some ORM have this feature, like http://docs.sequelizejs.com/manual/tutorial/models-usage.html#-findorcreate-search-for-a-specific-element-or-create-it-if-not-available . Or perhaps, upsert without
    update
    Copy code
    prisma.upsertAuthor({ 
      where: { 
        authorId: "some-id"
      },
      create: {
        authorId: "some-id"
      }
    })
    I know, it's possible to use upsert. But it requires us to
    update
    the field. Which Is not necassary in this case. Thanks
  • r

    Raj

    12/18/2018, 11:01 AM
    I am working on the howtographql tutorial on (https://www.howtographql.com/react-apollo/1-getting-started/ ). Has anyone ran into this issue, after prisma deploy, i try to run the following in the playground
    Copy code
    mutation CreatePrismaLink {
      post(
        description: "Prisma turns your database into a GraphQL API :sunglasses:",
        url: "<https://www.prismagraphql.com>"
      ) {
        id
      }
    }
    
    mutation CreateApolloLink {
      post(
        description: "The best GraphQL client for React",
        url: "<https://www.apollographql.com/docs/react/>"
      ) {
        id
      }
    }
    I get the following error "Error: Variable '$_v0_data' cannot be non input type 'LinkCreateInput!'. (line 1, column 22): mutation ($_v0_data: LinkCreateInput!)" Curious if anyone else noticed the same error
  • t

    THpubs

    12/18/2018, 1:25 PM
    Guys.. small question, does Prisma automatically round long decimal points? Have a problem when adding latitude and longitude values
  • t

    THpubs

    12/18/2018, 1:25 PM
    When we give 6.940043516608129 it stores 6.94004351660813
  • t

    THpubs

    12/18/2018, 1:25 PM
    That's 100m difference 🙂
  • j

    Josh

    12/18/2018, 2:00 PM
    @THpubs Looks like there is an open issue on GitHub to be able to store lat and long fields. I suppose you could change this to a string and convert it. https://github.com/prisma/prisma/issues/28
1...177178179...637Latest