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

    Zane Helton

    10/05/2020, 8:19 PM
    @Yann Pringault I gave up on deploying Prisma to Vercel. For my setup it'd require almost a full rewrite/full wrapper. I decided to just deploy it to ECS and it's much more..."standard" Idk what your setup is like, you may be able to get it to work
    y
    r
    • 3
    • 3
  • g

    Giorgio Delgado

    10/05/2020, 10:26 PM
    https://prisma.slack.com/archives/CKQTGR6T0/p1601928914303300
  • g

    Giorgio Delgado

    10/05/2020, 10:26 PM
    pictorally, the relationship is:
    Copy code
    comment --> post --> site
    a
    n
    • 3
    • 6
  • r

    Roy

    10/06/2020, 9:28 AM
    Hi guys. I am having a problem when doing a create() on a model. It returns the P2014 error. Anyone else had this error before? This is the mutation:
    Copy code
    async createPointsObject(
        points: number,
        notification: Notification,
        userEmail: string
      ) {
        return await this.prismaService.client.points.create({
          data: {
            points,
            Notification: { connect: { id: Notification.id } },
          },
        });
      }
    Here is my schema.
    Copy code
    model Points {
      id                  String              @id @default(cuid())
      points              Int
      createdAt           DateTime            @default(now())
      Notification        Notification
    }
    
    model Notification {
      id           String           @id @default(uuid())
      points       Points           @relation(fields: [pointsId], references: [id])
      pointsId     String
      createdAt    DateTime         @default(now())
      updatedAt    DateTime         @updatedAt
    }
    Full Error log:
    Copy code
    [dev        ]   The change you are trying to make would violate the required relation 'NotificationToPoints' between the `Notification` and `Points` models.
    .....................................................
    [dev        ]   code: 'P2014',
    [dev        ]   meta: {
    [dev        ]     relation_name: 'NotificationToPoints',
    [dev        ]     model_a_name: 'Notification',
    [dev        ]     model_b_name: 'Points'
    [dev        ]   }
    [dev        ] }
    r
    • 2
    • 1
  • r

    Ryota Murakami

    10/06/2020, 11:50 AM
    I'm migrating prisma1 to prisma2 right now, I hope I'll facing no issues and follow up to living newest prisma tech world! 🤗🚀
    prisma rainbow 4
    🙌 6
    🍀 4
  • m

    milos

    10/06/2020, 1:42 PM
    Hey, a question 🙂 What is your prefered strategy for validating Mutation inputs with Prisma + Apollo-server? I seen some middleware using Yup, but I am new to this, so someone who has a proven strategy would help me (just point me to it, I;ll research it) 🙂 eg. string length must be 8 or more… (I want to avoid going into resolvers and typing if (length < 8 ) return error… :)
    r
    p
    • 3
    • 4
  • a

    Aaron Fulkerson

    10/06/2020, 6:57 PM
    I guess I have kind of a weird use case here but let me try to explain. I’m trying to create a project management system where users will only be able to view and modify projects belonging only to their organization. The models I’m currently working on are Projects, Features and FeatureDetails. A Project has many Features and a Feature has many FeatureDetails. What I’m doing to reduce the number of times Prisma hits the database is calling prisma.project.update() to create a feature because it returns the entire project which I can then pass to a function that mutates the original object on the client side. It’s nice and clean but I’ve run into a couple of problems on the way. The first problem I want to mention is that it’s inconvenient that I have to create a unique index on the project’s id and companyId just to be able to ensure that a user may only access projects belonging to their organization when using the update method. In my opinion it doesn’t make sense that you can’t specify optional fields like the companyId in the where clause even though it’s not technically absolutely necessary to find the project, it would cover my use case. The other problem I’ve run into is that I can’t figure out how to nest a new FeatureDetail into an existing Feature in an existing Project using the update method on project. Is that possible?
    r
    • 2
    • 8
  • j

    Josef Henryson

    10/07/2020, 7:20 AM
    @schickling https://github.com/prisma-labs/http-link-dataloader this page refers to slack.graph.cool which gives 404.. perhaps more github pages refers to this old address? Just wanted to let you know…
    j
    • 2
    • 1
  • m

    milos

    10/07/2020, 9:35 AM
    Another strategy question. I am using Prisma with next-auth and only using discord to log in users. When user signs up on my app with discord, they have an avatarURL which shows up on the app and gets saved to DB. If user changes it’s profile picture on discord account, next time they log in, their profile picture is not updated. What is the best way to update it? Does next-auth provide something or I have to do it manually somehow? 🙂 Is there a proven strategy in doing this? Thanks
  • a

    Aaron Fulkerson

    10/10/2020, 5:19 AM
    So I thought this was kinda cool. There’s no such thing as cascading deletes in Prisma yet but I figured out that if you order your query properly and put an update before delete, you actually can get rid of associations before deleting the item you want to get rid of:
    Copy code
    return await db.project.update({
        data: {
          features: {
            update: { data: { featureDetails: { deleteMany: { featureId: id } } }, where: { id } },
            delete: { id },
          },
        },
        include: {
          company: true,
          features: { include: { featureDetails: { orderBy: { id: 'asc' } } } },
          invoices: true,
        },
        where: { id: projectId },
      })
    💯 1
    r
    • 2
    • 1
  • m

    Malik

    10/11/2020, 2:27 AM
    When will migrations be production ready on the roadmap?
    r
    • 2
    • 1
  • l

    Lars Ivar Igesund

    10/11/2020, 1:48 PM
    Do anyone know of the arrayFilters usage in the prisma mongo driver? Our database in testing seems to be older than the introduction of that feature, causing issues. The curious bit is that I am pretty sure that this didn't happen prior to a schema update I had. I am sortof presuming that more array updates are now done since the schema update created more relational links (but the old version weren't free of it either ...)
  • g

    Gabriel Oliveira

    10/11/2020, 2:31 PM
    Hi Does anyone knows if authentication headers will not work on netlify free plan as it states on their pricing page:
    r
    • 2
    • 8
  • a

    Abul Kashem

    10/12/2020, 7:20 AM
    How can I fix teh following error
    users-MacBook-Pro:prisma user$ docker-compose up -d
    prisma_postgres_1 is up-to-date
    prisma_prisma_1 is up-to-date
    users-MacBook-Pro:prisma user$ prisma deploy
     
    ▸  Could not connect to server at <http://localhost:4466>. Please check if your
     
    ▸  server is running.
    Get in touch if you need help: <https://slack.prisma.io>
    To get more detailed output, run $ export DEBUG="*"
    (node:10662) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
    `(Use
    node --trace-deprecation ...
    to show where the warning was created)`
    r
    • 2
    • 2
  • a

    Aaron Fulkerson

    10/12/2020, 5:33 PM
    It would be nice if I could get an item count along with a find query. Is that a planned feature?
  • l

    Laily Sarvarian

    10/12/2020, 5:34 PM
    hey,
  • l

    Laily Sarvarian

    10/12/2020, 5:40 PM
    this is my schema mode:type urlCommentData {  id: ID!  start: Int!  end: Int!  url: String!  count: Int!  kind: String!  comments: [Comment] @relation(name: "CommentUrls") } type Comment {  id: ID! @unique @id  text: String  imgs: [String] @scalarList(strategy: RELATION)  urls: [urlCommentData] @relation(name: "CommentUrls")  gif: String  createdAt: DateTime! @createdAt  updatedAt: DateTime! @updatedAt  commentOn: Caption! @relation(name: "CommentToCaption", onDelete: SET_NULL)  user: User! @relation(name: "CommentToUser", onDelete: SET_NULL)  replys: [Reply] @relation(name: "ReplyToComment", onDelete: CASCADE) } And this is my mutation which takes and array of objects: const CREATE_COMMENT = gql
    Copy code
    mutation CreateComment($comment: String!, $caption: ID!,$gif:String,$imgs:[String!],$urls:[urlCommentData!]) {
      createComment(
       data: {
        text: $comment
        imgs:{
         set:$imgs
        }
        urls:{
         create:$urls
        }
        gif:$gif
        user: { connect: { id: "ckg1dmbhk010707759dqhz5rq" } }
        commentOn: { connect: { id: $caption } }
       }
      ) {
      
       id
       text
     user{
      id
      name
     }
     commentOn{
      id
        text
       }
      }
     }
    But I am getting this error: ”index.js:26 Uncaught (in promise) Error: Variable '$urls' cannot be non input type '[urlCommentData!]'. (line 1, column 97): mutation CreateComment($comment: String!, $caption: ID!, $gif: String, $imgs: [String!], $urls: [urlCommentData!]) {“
    r
    • 2
    • 1
  • j

    Jos

    10/13/2020, 7:57 AM
    Hey guys aim trying to run a migration, and I dont want to give this column any value, any help??
    a
    r
    h
    • 4
    • 7
  • k

    KJReactor

    10/13/2020, 1:59 PM
    I want to be able to control costs by limiting the number of DB connections withing the range of available connections in my cloud hosting plan. I would like to know whether Prisma either throws connections away or can it handle a connection pool. If it can, how can it be done.
    r
    • 2
    • 11
  • a

    Aaron Fulkerson

    10/13/2020, 9:38 PM
    Have the developers considered allowing more options when creating an item in order to enforce foreign keys deeper in the model hierarchy? Let’s say I have ModelA which has many ModelB which has many ModelC. I want to allow a user to create an instance of ModelC but only if a key belonging to the user, let’s call it companyId, matches the companyId of an instance of ModelA. In order to do that I have to use prisma.modela.update() because when invoking prisma.modelc.create() I can only connect it to neighboring models which in this case would be ModelB.
    r
    • 2
    • 4
  • p

    Pieter

    10/14/2020, 8:51 AM
    @Daniel Norman I saw in the announcement that 2.9.0 paves the way to add native types for DB's. Does that mean this issue will soon be solved? https://github.com/prisma/prisma-client-js/issues/813
    d
    • 2
    • 1
  • j

    jknr

    10/14/2020, 12:42 PM
    why isn't there any channel to discuss prisma-upgrade ? 😄
  • j

    Justin Ellingwood

    10/14/2020, 12:43 PM
    Hey there 👋 just a heads up that we've added a new guide on authentication and authorization in MySQL to Prisma's Data Guide: https://www.prisma.io/dataguide/mysql/authentication-and-authorization/intro-to-authn-and-authz
    💯 3
    prisma green 5
  • j

    jruiseco

    10/14/2020, 2:53 PM
    Anyone ever seen
    Copy code
    Err parsing connection string: invalid port number in .......:33060/mysql
    r
    j
    • 3
    • 9
  • t

    tmoney

    10/14/2020, 2:58 PM
    Anyone have any suggestions for node.js graphql server granular performance monitoring? Or have any experience with certain tools you could recommend or share your experience with?
  • b

    brandon

    10/14/2020, 3:20 PM
    It seems if prisma 2 doesn't support mongodb and there has been radio silence on when it'll come out. Has there been an update? Or does anyone have a recommendation of a tool to use for mongodb?
    r
    • 2
    • 2
  • n

    Natalia

    10/14/2020, 4:23 PM
    WarsawJS Meetup starts in 7 minutes - featuring Daniel Norman, Developer Advocate of Prisma 🦜prisma cool Tune in here!
  • r

    Ryan

    10/15/2020, 7:27 AM
    Hey Salman 👋 Could you try again by relinking your Heroku account from the settings?
    s
    • 2
    • 2
  • n

    Natalia

    10/15/2020, 2:03 PM
    👋 “What’s new in Prisma (v2.9.0)” live stream is on now! Daniel and Ryan from Prisma talk about new releases, planned features and other interesting bits from the Prisma world.* 

    Tune in here▾

    !* 🦜
    prisma green 2
    💯 2
    prisma rainbow 2
    prisma cool 2
  • p

    Paul Hendrickson

    10/15/2020, 7:02 PM
    Does anyone know where to go for support?
    a
    r
    • 3
    • 12
1...400401402...637Latest