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

    James Fox

    01/11/2020, 4:56 PM
    Using
    prisma-nexus
    , is there any way to use the Field Authorize Plugin with
    t.crud.<model>
    ? Or would I need to go with a middleware solution like
    graphql-shield
    ?
  • j

    James Fox

    01/11/2020, 4:57 PM
    AFAIK, i cannot yet do something like:
    Copy code
    t.crud.item({
      authorize: (root, args, ctx) => ctx.auth.hasPermission(args),
    })
  • a

    Alfred Ödling

    01/11/2020, 4:57 PM
    Hi all! I am thinking about using Prisma for a VC-backed venture that has quite complex relations database-wise. Is Prisma ready for production use or should I continue using Sequalize? My question more specifically is, what are the limitations currently?
  • a

    Andres Montoya

    01/11/2020, 5:51 PM
    Hi! I have a little question that is not about Prisma but maybe someone can help me. It's, what do you use for authentication with Next.js, I wanted to use Auth0 with the Now API functions, but the package built for this is in beta yet...
    c
    • 2
    • 2
  • s

    Sherbakov

    01/12/2020, 11:31 AM
    Hello! Could you help me to understand what is going wrong with type relations and the logic I'm trying to implement? So, I have 2 types: Theme and Item. It is 1:n relation, so a theme has many items. When I run this query on the Prisma server, everything works fine.
    h
    • 2
    • 4
  • m

    Marton Langa

    01/13/2020, 8:36 AM
    Is there a way to add indices manually to foreign keys? Can’t wait for this feature: https://github.com/prisma/specs/issues/280 😐 Thanks!
  • v

    Victor Kolb

    01/13/2020, 2:27 PM
    Hello! I got error when try to connect to postgesql Yandex Cloud database.
    Copy code
    org.postgresql.util.PSQLException: ERROR: pgbouncer cannot connect to server
    in a few hours I couldn't find a solution on the Internet ((
  • r

    raji hawa

    01/13/2020, 8:53 PM
    hey guys i kinda need some help with prisma it was working perfectly yesterday but today it gave me this error No cluster could be found for workspace '*' and cluster 'default' i have my secrets set up and all tried to change the endpoit to host.docker.internal:4466 and prisma:4466 and localhost:4466
  • a

    ajmakhl

    01/14/2020, 3:09 AM
    Hello, I was wondering if something like this is possible with relationships. I basically want to use Detail type to be related to many different types.
    Copy code
    type Detail {
    	id: ID!
    	title: String
    }
    type Example1 {
    	id: ID!
    	detail: Detail!
    }
    type Example2 {
    	id: ID!
    	detail: Detail!
    }
    basically im trying to see if I can avoid doing this to the type Detail..
    Copy code
    type Detail {
    	id: ID!
    	title: String
    	example1: Example1
    	example2: Example2
    }
    Thanks in advance.
  • j

    Jizong

    01/14/2020, 4:30 AM
    In mongodb, I want to find an object with a specific id, then update it’s subdocument array according to matches, I tried with findOneAndUpdate(), but don’t know how to make it to work. does anyone know mongodb well enough to give me some tips?
  • j

    James Fox

    01/15/2020, 6:54 AM
    Im trying to setup a simple relationship with prisma2, nexus-prisma, and nexus, but I cant seem to get this to work:
    Copy code
    # Models
    model Post {
      post_id  String    @id
      category Category?
    }
    
    model Category {
      category_id String @id
      description String
    }
    Copy code
    // Schema
    const Post = objectType({
      name: "Post",
      definition(t) {
        t.model.post_id();
        t.model.category();
      }
    })
    
    const Category = objectType({
      name: "Category",
      definition(t) {
        t.model.category_id();
        t.model.description();
      }
    })
    
    const Query = objectType({
      name: "Query",
      definition(t) {
        <http://t.crud.post|t.crud.post>();
        t.crud.posts({ filtering: true, pagination: true });
        t.crud.category();
        t.crud.categorys({ filtering: true, pagination: true });
    Copy code
    // GraphQL query
    post(first: 1) {
      name
      category {
          description
      }
    }
  • j

    James Fox

    01/15/2020, 7:00 AM
    This gives me an error
    "Argument \u001b[1mwhere\u001b[22m of type \u001b[1mPostWhereUniqueInput\u001b[22m needs \u001b[92mat least one\u001b[39m argument. Available args are listed in \u001b[2m\u001b[32mgreen\u001b[39m\u001b[22m."
    n
    • 2
    • 6
  • j

    James Fox

    01/15/2020, 7:01 AM
    Changing the Post schema to define
    category
    manually prevents the error, but
    category
    is returned as null:
    Copy code
    t.field("category", {
      type: Category,
      nullable: true
    });
    l
    k
    • 3
    • 16
  • l

    lionbrahh

    01/15/2020, 9:14 AM
    hello guy, do you using graphql-yoga and Nexus and Prisma in Production?? i follow example with Typescript with Nexus graphql , Prisma, graphql-yoga , mongoDB, i have tried from 3 days ago till now, always failed to run graphql with typscript in production mode , do you use pm2 for running them ? or Docker ? if anyone here been successfully running those app, i do love to hear from you , thank you, #yourHelpMeaningForMe
  • m

    michieldewilde

    01/15/2020, 9:16 AM
    Is there a way to migrate from table to inline relations if you are coming from an older version of prisma?
    r
    • 2
    • 2
  • v

    Viktor Szépe

    01/15/2020, 9:36 AM
    Copy code
    type Starship {
      id: ID!
      name: String!
      length(unit: LengthUnit = METER): Float
    }
    Is there a way to do syntax check on graphql queries?
  • v

    Viktor Szépe

    01/15/2020, 9:37 AM
    ...and Schemas
  • h

    horia.ancas

    01/15/2020, 10:19 AM
    does
    prisma import --data something.zip
    support pause and resume? It says so here, but I don't know how to do it https://www.prisma.io/docs/prisma-cli-and-configuration/data-import-and-export-jsw9/#data-import-with-the-cli
  • h

    horia.ancas

    01/15/2020, 10:22 AM
    the problem I'm facing is
    prisma import ...
    takes longer than 30 seconds and times out on heroku
  • l

    Lukas Greb

    01/15/2020, 4:07 PM
    What would be the recommended way to implement a comment with replies schema (+resolvers)?
    Copy code
    Datamodel:
    type Comment {
        id: ID! @id #database id
        commentId: String! @unique #given id
        author: Author! @relation(link: INLINE)
        video: Video! @relation(link: INLINE)
        parent: Comment @relation(link: INLINE)
        text: String!
        likeCount: Int!
        publishedAt: DateTime!
        replies: [Comment]! ?????
    }
    
    Insert mutation:
    
        const author = await context.prisma.author({
            authorChannelId: args.comment.authorChannelId
        })
    
        const video = await context.prisma.video({
            videoId: args.comment.videoId
        })
    
        return context.prisma.createComment({
            commentId: args.comment.commentId,
            author: { connect: { id: author.id } },
            video: { connect: { id: video.id } },
            parent: args.comment.parentId ? { connect: { id: args.comment.parentId } } : {},
            text: args.comment.text,
            likeCount: args.comment.likeCount,
            publishedAt: args.comment.publishedAt,
            replies: ???
        })
    Could someone guide me to some related ressources? Edit: I'm using GQL1, MongoDB, Yoga
    s
    • 2
    • 2
  • a

    Alice

    01/16/2020, 7:55 AM
    Hi, I am new to prisma, when i deploy, i found below error message Could not connect to server at http://localhost:4466. Please check if your server is running.
  • a

    Alice

    01/16/2020, 8:27 AM
    docker ps returns nothing, i have stopped all the containers
    s
    • 2
    • 1
  • j

    Julien C.

    01/16/2020, 2:53 PM
    Hello ! I want to debug prisma server (v1) locally, what is the simplest way to run it (from source) ?
    • 1
    • 1
  • j

    Jaafari El Housseine

    01/16/2020, 7:09 PM
    Hey everyone 👋
    👋 3
  • s

    Sothy Chan

    01/17/2020, 1:15 AM
    Hello! We upgraded our prisma server to 1.34.10 and had to update our data model to v1.1 per instructions, but our updates are failing. It appears that a connection is trying to be made, and so tries to insert an id to the I'd column in the relation table, but that id column has been removed in the new prisma server. Any thoughts on what else needs to be updated?
  • l

    lionbrahh

    01/17/2020, 8:15 AM
    does anyone here using prisma-nexus ? , when i using objectType with definied t.model.id() and so on….. they are undefined , it seems cant readt t.model, anyoone has same problem ??
    d
    • 2
    • 3
  • d

    dwirya

    01/17/2020, 10:49 AM
    Does PhotonJS fetch relations in a batched manner ? Meaning, if I am querying 2 relations, does Photon fetch one relation after the other, or does it fetch two relations from the DB in one go ?
  • m

    Mounika

    01/17/2020, 11:29 AM
    Can’t deploy => Error: spawn ENAMETOOLONG
  • c

    captaindaylight

    01/17/2020, 8:50 PM
    I'm moving some old data from airtable to prisma, but I want to set the createdAt to the time defined on airtable through prisma. Is there a way to do this? It seems like it's immutable and read-only, but there must be a way to migrate data...
  • j

    Julius Dockwarder

    01/18/2020, 5:55 PM
    Hello everyone, excited to be here!
1...342343344...637Latest