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

    Oscar

    05/06/2020, 6:38 PM
    In the previous prisma version you could add an onDelete on a @relation. How can you do that in prisma2? It is impossible now to delete a model that is attached to something.
    j
    a
    r
    • 4
    • 8
  • n

    Nicholas Eli

    05/06/2020, 9:08 PM
    Hello, I have recently inherited a project using GrapQL/Prisma combo, things were going pretty well until I tried to sort nested relationships. Any chance someone could point me in the right direction? I feel like I am pretty close (I hope). I will post an example in this thread.
  • n

    Nicholas Eli

    05/06/2020, 9:12 PM
    Resolver
    getPosts(_parent_, _args_, _ctx_, _info_){
    return ctx.db.query.posts({}, info)
    }
    Data Model
    type Post {
    id: ID! @id
    isPublished: Boolean! @default(_value_: false)
    title: String!
    text: String!
    connections: [Connection!]! @relation(_name_: "ClientConnect")
    }
    type Link {
    id: ID! @id
    text: String!
    url: String!
    }
    type Connection {
    id: ID! @unique @id
    client: Link @relation(_name_: "LinkConnect")
    }
    Schema
    type Query {
    getLinks(_filter_: String, _skip_: Int, _first_: Int, _orderBy_: LinkOrderByInput): [Link!]!
    }
    When I try to query this in the playground, on the
    Connection
    object, it references sort for that object. How can I refer it to the
    Link
    so that I may order on text or url
    • 1
    • 1
  • y

    Yasir Hussain

    05/06/2020, 9:54 PM
    Copy code
    Anyone please help me.
  • b

    BRob

    05/06/2020, 11:02 PM
    Has anyone been getting the error
    duplicate key value violates unique constraint
    on upsert calls? Attempting to figure out a good repro case so I can create an issue but it seems sporadic and I can't quite tell how it is happening.
    r
    • 2
    • 2
  • a

    Amir Braham

    05/06/2020, 11:23 PM
    Hi , I don't know if this is a bug or not but here's the current issue : generated a simple dev.db file , added one record with field name, let's say 'Post-1' added @unique to the name field when I try to add a new record with the same name 'Post-1' , it works and doesn't give any error , which results in duplicate names adding another record 'Post-1' now gives an error.
    a
    • 2
    • 1
  • r

    Raluca Fleseriu

    05/07/2020, 12:46 PM
    Hello, I'm using Prisma 1, and I have a Float that holds a timestamp (whch is very inefficient when trying query data by it in a table with a lot of records since in PostreSQL gets as a numeric with 65 digits percision) . 1. My plan si to convert the Float into a DateTime. Do you think that would be a better choice from performance perspective? 2. I suppose I would lose my data if I convert it straignt from the datamodel.graphql, right? So, I'm creating a new field and try to transfer the data. Is there an easy way to do that? updateMany methods can somehow reference itself record? Or, I need to query each field, get data and update it one by one?
    r
    • 2
    • 5
  • q

    Quentin Nicolle

    05/07/2020, 1:48 PM
    Hi all ! I have an interrogration ! Graphql-yoga is really cool to use ! Do you know if this project still alive? because we haven’t seen any commits in a while, unfortunately. 😕
  • s

    Samrith Shankar

    05/07/2020, 2:01 PM
    @Quentin Nicolle I switched from it to Apollo Server. It was seamless. I’d recommend it. Specifically with Yoga using it internally as well.
    👍 1
  • q

    Quentin Nicolle

    05/07/2020, 2:03 PM
    totally true ! I’l follow your recommandation ! thanks a lot @Samrith Shankar!
  • s

    Samrith Shankar

    05/07/2020, 2:04 PM
    Let me know if you need help! You can also check this repo out, and look through the commi: https://github.com/troup-io/troup-server/commit/f8da562472583b5f72d91c2f64b4952a4de54678
    😍 1
  • q

    Quentin Nicolle

    05/07/2020, 2:05 PM
    amazing !! that’s what i started to search ! 😄
    r
    • 2
    • 2
  • o

    Omobolanle Aro

    05/07/2020, 3:15 PM
    Hi guys, I've had trouble updating an array in an embedded type. I'm hoping someone has done this before.
    type Comment @db(name: "comments"){
    id: ID! @id
    text: String!
    comic: Comic!
    likes: Likes!
    replies: [Reply!]!
    createdAt: DateTime! @createdAt
    updatedAt: DateTime! @updatedAt
    }
    type Likes @embedded {
    count: Int! @default(value: 0)
    voted: [User!]!
    }
    I'm trying to update the voted array in the likes type when I update Comments but I haven't been able to do that successfully, Any help will be strongly appreciated.
  • o

    Omobolanle Aro

    05/07/2020, 3:25 PM
    Here is my current attempt to update the voted field
    mutation{
    updateComment(where: {
    id: "5eb411d263445900078ced23"
    }
    data: {
    likes: {
    update: {
    count: 1,
    voted: {
    connect: [
    {
    id: "5eb4104b63445900078ced12"
    },
    ]
    }
    }
    }
    }
    ){
    id
    likes{
    count
    voted{
    lastName
    firstName
    }
    }
    }
    }
  • j

    Javanie Campbell

    05/07/2020, 6:42 PM
    @channel Regarding #graphql-yoga it is one of the best servers I have used as it builds on top of existing tooling given that #prisma wants to improve tooling wouldn't it make sense to hand over the maintenance of that project to #guild team like you did with other packages as #prisma-labs is only focused on #nexus that only supports node v9 and below .... I really love the project as it unifies the Apollo GraphQL teams hard-work and marry it with you #prisma teams work as the closest thing to a unified holistic development environment that is becomes somewhat agnostic when done in the way #graphql-yoga was put together so we can take advantage of the entire ecosystem tooling from the various movers in GraphQL community rather than heavily opinionated one sided track so I bed @channel please please address the continuation of an awesome project to V2 or a successor that embodies what #graphql-yoga and #prisma team has aimed to do which is unified ecosystem and tooling
  • j

    Javanie Campbell

    05/07/2020, 7:05 PM
    I need some help with prisma generate for prisma 1 cli I'm getting ' Cannot read property of 'startsWith' of undefined' help has anyone come across this issue and found a fix??
    r
    • 2
    • 6
  • m

    Melvin Pacheco

    05/07/2020, 10:12 PM
    are subscriptions support yet in prisma 2?
    r
    • 2
    • 2
  • m

    mjyoung

    05/07/2020, 11:15 PM
    Is there a way to create a prefixed id? like:
    Copy code
    model User {
      id        String    @default("user_" + cuid()) @id
    }
    r
    • 2
    • 1
  • s

    Suhail

    05/08/2020, 7:31 AM
    I am on
    prisma 1.34
    and hitting a weird situation. It almost takes 35 seconds for the query to get completed when it fetches me the results under 1 second when using Robo3T or any other GUI client for Mongo. What could be the reason for this? I am already querying on the index. Any suggestions? I have also posted on StackOverflow : https://stackoverflow.com/questions/61674149/takes-35-seconds-to-query-a-mongo-collection-when-using-prisma-inspite-of-queryi
  • k

    kitze

    05/08/2020, 2:27 PM
    Me and @nikolasburk are gonna discuss Prisma in a few mins, so feel free to drop in with questions etc. 😄 https://mobile.twitter.com/thekitze/status/1258749947048013825
    prisma green 4
    🙌 1
    prisma cool 2
    🇳🇬 1
    fast parrot 2
  • r

    Rodrigo Perez

    05/08/2020, 3:20 PM
    Hi everyone! I am entering this world of Prisma and GraphQL and there is something that I can't figure out yet. When I ran the docker prisma server, as far as I can see it already created a GraphQL server, so where is the need to put an Apollo or Yoga server in between my app? If the answer is in the documentation and I couldn't found it, please feel free to answer me with a link 🙂 Cheers!
    a
    r
    • 3
    • 2
  • s

    Slackbot

    05/09/2020, 12:46 PM
    This message was deleted.
    r
    • 2
    • 1
  • g

    Gabriel Colson

    05/09/2020, 2:05 PM
    Hey everyone! I love Prisma but I work on Webstorm and there is no official plugin for IntelliJ based IDEs yet. This is why I wrote my own: https://github.com/gabrielcolson/intellij-prisma. It only supports basic syntax highlighting (a new release with better syntax highlighting is waiting  for JetBrains approval). This is just a start and there is a lot of room for improvements and new features like autocompletion, code references, auto format, and so on. I am more than open to contributions. Feel free to come talk to me in DM if you want to. Have a good day!
    ❤️ 5
    k
    • 2
    • 2
  • s

    Scott

    05/09/2020, 3:39 PM
    how does prisma compare to Mongoose? Does prsima 2 with with MongoDB?
    r
    • 2
    • 1
  • t

    TEMILOLUWA OJO PHILIP

    05/10/2020, 12:57 PM
    Hi everyone, please has anyone successfully implemented subscriptions in nexus ?
  • r

    Ryan

    05/11/2020, 3:34 PM
    I have created a basic subscriptions example using the
    PubSub
    module of
    apollo-server
    with Prisma 2 here. I have used shield as an auth mechanism as well.
    👍 1
    🤝 1
    prisma cool 1
    fast parrot 5
  • j

    Jan

    05/11/2020, 5:14 PM
    Hello everyone, I want to ask that can I use batch operation on playground? I'm very new to this. Thank you for guiding 🙂
  • h

    Hanyati

    05/11/2020, 6:29 PM
    hi guys i need some help on how to add UUID field into prisma, the doc does not clearly points it
  • e

    Ethan Pursley

    05/11/2020, 7:02 PM
    `id: ID! @id`i think?
  • l

    Lars-Jørgen Kristiansen

    05/11/2020, 8:22 PM
    I'm looking at this prisma2 example: https://github.com/prisma/prisma-examples/tree/master/typescript/graphql-apollo-server It has a model like this:
    Copy code
    model User {
      id    Int     @default(autoincrement()) @id
      email String  @unique
      name  String?
      posts Post[]
    }
    
    model Post {
      id        Int     @default(autoincrement()) @id
      authorId  Int?
      content   String?
      published Boolean @default(false)
      title     String
      author    User?   @relation(fields: [authorId], references: [id])
    }
    If i run this query:
    Copy code
    query {
       filterPosts{
        id
        title
        author {
          name
        }
      }
    }
    Why does prisma run 3 SQL queries?
    Copy code
    SELECT "public"."Post"."id", "public"."Post"."authorId", "public"."Post"."content", "public"."Post"."published", "public"."Post"."title" FROM "public"."Post" WHERE 1=1 OFFSET 0;
    
    SELECT "public"."Post"."id", "public"."Post"."authorId" FROM "public"."Post" WHERE "public"."Post"."id" IN (1,2,3,4,5,6) OFFSET 0;
    
    SELECT "public"."User"."id", "public"."User"."email", "public"."User"."name" FROM "public"."User" WHERE "public"."User"."id" IN (1, 2) OFFSET 0
    The second query seems unnecessary?
    a
    r
    • 3
    • 12
1...371372373...637Latest