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

    Andrew O.

    08/22/2019, 6:05 PM
    Does anyone have experience connecting to an existing MySQL DB with Prisma? I can get it to build the datamodel.prisma file, but can't get prisma to connect to the correct Schema.
  • k

    ksm

    08/22/2019, 8:17 PM
    I'm running a prisma cluster (1.33.0) on k8s. Everything works per docs but I noticed that prisma tacks on the pod name as part of the rabbitmq queue name, and as the prisma pods get restarted in the k8s cluster the rabbitmq prisma queues (project-schema-invalidation-exchange and sss-events-exchange) that backed the deleted pods remain and are actually still listed as having consumers so the queues never auto-delete. Anyone running with this type of setup that can verify if this is indeed a bug?
  • p

    Pkmmte

    08/23/2019, 12:08 AM
    Anyone here have good examples for querying objects based on relations? For example,
    get the top 10 users with the most posts
    I get that I could create an index for this, but what if I want to apply a time filter for most posts created within a time period?
  • g

    Ghassen Ghabarou

    08/23/2019, 12:26 AM
    Hello, is it normal that the OR field in userWhereInput is not generated in prisma.scheme.js or is there a problem with my installation. I'm using mongodb
  • a

    Akshay Kadam (A2K)

    08/23/2019, 9:43 AM
    How do I set args on Query in Prisma using Nexus? I've cloned this starter kit → https://github.com/ntlf/graphql-starter which uses Prisma 1 and Nexus. I changed
    datamodel.prisma
    to:
    Copy code
    type Pokemon {
          id: ID! @id @unique
          number: Int! @unique
          name: String!
          attacks: PokemonAttack
        }
    
        type PokemonAttack {
          id: Int! @id
          special: [Attack]
        }
    
        type Attack {
          id: Int! @id
          name: String
          damage: String
        }
    And changed
    Query.js
    to:
    Copy code
    import { prismaObjectType } from 'nexus-prisma';
    
        export const Query = prismaObjectType({
          name: 'Query',
          definition(t) {
            t.crud.findManyPokemon({
              alias: 'pokemons'
            })
    
            t.list.field('pokemon', {
              type: 'Pokemon',
              args: {
                name: stringArg(),
              },
              resolve: (parent, { name }, ctx) => {
                return ctx.prisma.pokemon.findMany({
                  where: {
                      name
                  }
                })
              },
            })
          },
        });
    Then I deployed the whole thing but I still don't get
    name
    as an argument on field
    pokemon
    . Idk what I am doing wrong. The complete code is in the subdirectory
    prisma1-demo
    → https://github.com/deadcoder0904/graphql-and-urql-by-example/tree/master/prisma1-demo I've tried writing it from scratch and by downloading a boilerplate for the last 2 days but nothing seems to help. Any suggestions?
  • k

    Kashif

    08/23/2019, 11:10 AM
    Hi I am new here and a begginer getting started on prisma
  • k

    Kashif

    08/23/2019, 11:10 AM
    i am having a issue if anyone can help me fix it
  • k

    Kashif

    08/23/2019, 11:10 AM
    prisma deploy ▸ Could not connect to server at http://localhost:4466. Please check if your server is ▸ running.
  • k

    Kashif

    08/23/2019, 11:11 AM
    version: '3'
    services:
    prisma:
    image: prismagraphql/prisma:1.34
    restart: always
    ports:
    - "4466:4466"
    environment:
    PRISMA_CONFIG: |
    port: 4466
    # uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
    # managementApiSecret: my-secret
    databases:
    default:
    connector: mysql
    host: host.docker.internal
    schema: prisma_prac
    user: root
    password: ''
    rawAccess: true
    port: '3306'
    migrations: true
  • k

    Kashif

    08/23/2019, 11:24 AM
    Hi I am new here and a begginer getting started on prisma i am having a issue if anyone can help me fix it prisma deploy ▸ Could not connect to server at http://localhost:4466. Please check if your server is ▸ running. Pinned by you
    version: '3'
    services:
    prisma:
    image: prismagraphql/prisma:1.34
    restart: always
    ports:
    - "4466:4466"
    environment:
    PRISMA_CONFIG: |
    port: 4466
    # uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
    # managementApiSecret: my-secret
    databases:
    default:
    connector: mysql
    host: host.docker.internal
    schema: prisma_prac
    user: root
    password: ''
    rawAccess: true
    port: '3306'
    migrations: true
  • k

    Kennah

    08/23/2019, 11:25 AM
    Hello guys am building a web app using next js and graphql-yoga. In graphql-yoga docs they have stated that Middlewares can also be added specifically to the GraphQL endpoint route, by using server.express.post(server.options.endpoint, myMiddleware()). I have tried to implement this on a endpoint '/payment' but its not working. I have tried with all other routes but none is working expect the index route '/'. Why is this happening anyone with an idea.
  • r

    rdc

    08/23/2019, 1:41 PM
    How do I add https to EC2 Amazon Linux? https://www.prisma.io/forum/t/add-https-to-ec2-amazon-linux-2-ami-with-prisma-running-with-nginx/7737
  • n

    Ngr Dev

    08/23/2019, 1:46 PM
    Hi everyone. I have a setup with
    prisma2
    ,
    nexus
    and
    graphql-yoga
    . I would like to query for multiple Posts for which I already know their
    id
    . Photon seems to support this with e.g.
    photon.posts.findMany({where: {OR: [{id: "post1"}, {id: "post2"}]}});
    and by adding
    t.crud.findManyPost({alias: "posts"});
    I can query for multiple posts, but the only arguments the graphQL query takes are the default ones (
    skip
    to
    last
    ). Is there a simple way to enable e.g.
    where
    ? Thanks for your feedback!
    • 1
    • 1
  • j

    JBriggs

    08/23/2019, 2:11 PM
    @Ngr Dev you should be able to do
    { where: {or: { [ id: 1, id: 2 ]  } } }
    At least I can
  • n

    Ngr Dev

    08/23/2019, 2:37 PM
    @JBriggs The graphQL query schema does not seem to support a
    where
    . Or where should I put your snippet?
    Copy code
    posts(
        skip: Int
        after: String
        before: String
        first: Int
        last: Int
    ): [Post!]
  • j

    JBriggs

    08/23/2019, 2:38 PM
    Copy code
    categories(where: CategoryWhereInput, orderBy: CategoryOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [Category]!
  • j

    JBriggs

    08/23/2019, 2:38 PM
    this is one schema I have
  • j

    JBriggs

    08/23/2019, 2:38 PM
    I believe you are missing it on your custom-schema
  • j

    JBriggs

    08/23/2019, 2:38 PM
    the above code is generated by prisma
  • j

    JBriggs

    08/23/2019, 2:39 PM
    or am I missing something 😕
  • n

    Ngr Dev

    08/23/2019, 2:42 PM
    Hm. I believe I'm the one missing something. 😉 I can e.g. en- or disable pagination (
    first
    etc) with
    t.crud.findManyPost({alias: "posts", pagination: false});
    , respectively
    pagination: true
    . Do I need to add some special property to enable
    where
    ?
    n
    j
    • 3
    • 34
  • n

    Novalis

    08/23/2019, 3:27 PM
    Quick Question: Are there any best practices for building a microservice architecture with prisma1 & prisma2? E.g.: shared Database vs. non-shared, etc. Sadly i can't find a lot of resources about that 😅
    m
    o
    • 3
    • 11
  • o

    Oliver Evans

    08/23/2019, 5:40 PM
    Hi! I'm using prisma with the MongoDB connector, and I'm noticing that prisma is generating lots of connections, to the point that I'm getting `MongoWaitQueueFullException`s because more than 500 connections are attempting to contact mongo. Any advice to debug or improve this?
  • d

    Daniel Mahon

    08/24/2019, 12:51 AM
    Hello all, Im having issues with GraphQL “subscriptions” through Prisma. Its bascially the “Quantum Mechanics” issue where as as soon as a browser tab is open and subscribes to an endpoint the server starts degrading heavily in scale to how many subscribers there are…
  • d

    Daniel Mahon

    08/24/2019, 12:53 AM
    The server currently watches for pub/sub events and then updates the database via prisma accordingly, there can be infinite browser clients who subscribe to updates via graphql but as soon as a client connects it drags even the “update” function and mutation down from 500ms to 2secs, another client adds another 2 seconds, and so on, eventually bringing everything to a halt.
  • d

    Daniel Mahon

    08/24/2019, 12:54 AM
    Any ideas? It almost seems as if the update mutation wont complete until every client has been sent their subscription updates….which seems wrong.
  • r

    Ruslan Baigunussov

    08/24/2019, 10:03 AM
    Hi! How can I add the new
    orderBy
    option in my existing query? I already have some auto-generated option in this field, but how can I extend this?
  • e

    evondev

    08/24/2019, 10:34 AM
    hello everybody. Anybody knows how to exports prisma database. I am currenty can not export relations in prisma, after export the relations are not match so I can't import to another database ? 😞
    c
    • 2
    • 2
  • c

    Corey Snyder

    08/25/2019, 3:04 AM
    If I have a schema which looks like below, where a User can have many images, but I don’t have a field on the image to point back to the User. How do I save a new Image and have it connect to the user? I was thinking I would omit the
    User
    on the
    Image Type
    because I’ve no reason to query for the user based on the Image ID. But I don’t know how to make that call in the code to save.
    Copy code
    type User {
      id: ID! @id
      name: String
      images: [Image] @relation(onDelete: CASCADE)
    }
    
    type Image{
      id: ID! @id
      createdAt: DateTime! @createdAt
      filename: String!
    }
    Normally my create calls look like this ⬇️ but I believe this code would require a
    user
    field on my
    Image
    type.
    Copy code
    context.prisma.createImage({
              filename: "test",
              user: { connect: { id: args.user.id } }
            })
    Am I thinking about this correctly? Should you always have bi-directional references between the two tables with a relationship like this?
    • 1
    • 3
  • c

    Corey Snyder

    08/25/2019, 3:20 AM
    Maybe this question is less of a prisma and more of a DB design question but I was curious how you handle the scenario where you have a table/type like this;
    Copy code
    type Image{
      id: ID! @id
      createdAt: DateTime! @createdAt
      product: Sandwich!
      postedBy: User!
      filename: String!
    }
    And as you can see it’s very tightly tied to Sandwiches 🥪. But what if I wanted to introduce a new
    Dessert
    🍦 type which will also have images. How does one handle that? I don’t want to have to create a new
    DesertImages
    Type as this won’t scale as I move into other products. And I can’t have the
    product
    field point to both
    Sandwich
    and
    Dessert
    right? This is going to be a problem I’ll run into, all over my code, real soon as I move on from having just 1 type of product in my app and I’m not sure how to handle it.
    i
    • 2
    • 6
1...303304305...637Latest