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

    Neo Lambada

    07/27/2021, 7:55 PM
    if i can do this from prisma. ill switch to prisma
  • f

    Faiyam Rahman

    07/27/2021, 8:55 PM
    Is there any intention for prisma to natively support having separate read and write clients? For context, we (wearseasons.com) are working to scale our DB. One step of that process is moving to a DB cluster with one "write" node and a set of "read" nodes which are all downstream of the leader "write" node. To do this we need to send mutations to the write node and read requests to the load balancer sitting in front of the read nodes. Since this is a pretty common thing for eng teams to do, I was curious if prisma has any plans (or existing functionality?) to take in separate read/write DB URLs and automatically route things accordingly. cc @Luc Succes
    l
    r
    • 3
    • 3
  • d

    David

    07/27/2021, 9:11 PM
    QUESTION: In my data model I have Users and Groups. The User can join many groups and groups can have many members. I set up a many to many relationships in Prisma . I set up a graphql query in Nexus and can query the users groups but what's coming back is each user has all of the groups on it. How do I filter the many to many by user Id or group Id? Here is my schema.prisma file and the nexus ts file. Any help would be great! I am new to Prisama and really like the way it works!
    User.tsschema.prisma
    r
    • 2
    • 2
  • n

    nikunj chaudhari

    07/28/2021, 1:48 AM
    I have lot's of data in
    json
    file How do i send mutation?
    r
    • 2
    • 8
  • g

    Gelo

    07/28/2021, 2:56 AM
    How to implement transactions with dependent nested writes. eg: query[2] will depend on query[1] result and so on...
    r
    • 2
    • 4
  • g

    gershon bialer

    07/28/2021, 5:15 AM
    Could DateTime be changed so it can serialize properly into json?
    g
    r
    • 3
    • 2
  • f

    Faizan

    07/28/2021, 6:59 AM
    Copy code
    model Campaign {
      id               String             @id @default(uuid())
      company          Company            @relation(fields: [companyId], references: [id])
      companyId        String
    }
    model Company {
      id               String @id @default(uuid())
      Campaign         Campaign[]
    }
    ------------------
    
    await prisma.campaign.updateMany({
        where: { id: campaignId, companyId },
        data: { ...data }
    });
    I have to query campaign by it's ID but I also use company ID(which is authenticated) to match and verify that the campaign belongs to the authorized company rather than just updating it. But I have to use
    updateMany
    instead of
    update
    because update does not support more than one argument in the where. I need to the updated object as the return value which is available in
    update
    which I can not use due to the above limitation. Is there a workaround for this? Thanks.
    r
    • 2
    • 5
  • b

    Bodhi Vandael

    07/28/2021, 9:50 AM
    Heya! I've got a really stupid problem, I want to add a facebookId to my db. Local, all works fine. But the second it build on production, it says facebookId does not exit on UserCreateInput
    ✅ 1
    r
    • 2
    • 10
  • b

    Bodhi Vandael

    07/28/2021, 9:50 AM
    facebookId exists in schema.prisma
  • g

    Gelo

    07/28/2021, 10:20 AM
    Hi does prisma automatically locate relation? for example user has one profile then I want to update the profile of the user using user id as the pointer will work the same as using the profile id of the user?
    r
    • 2
    • 2
  • m

    Matt Pocock

    07/28/2021, 11:32 AM
    Hey folks. I'm using Prisma on serverless with Next.js/Vercel and noticing what I'm quite sure are idle zombie connections that are taking over my database.
    m
    d
    • 3
    • 2
  • m

    Matt Pocock

    07/28/2021, 11:32 AM
    I'm already using pgbouncer (Postgres db), but I'm looking to see if anyone else has run into this issue.
  • n

    nikunj chaudhari

    07/28/2021, 1:08 PM
    On general note We can marked solved query with ✅ And if still unsolved then we mark with ❓ . It Will be helpful.
    ❓ 1
    ✅ 1
    • 1
    • 1
  • p

    Patrick

    07/28/2021, 1:59 PM
    Anybody here used prisma in e2e tests with time mocking from sinonjs? I always get an error after advancing mocked time with e.g.
    await clock.tickAsync(10000)
    I need to mock time to test for cases like correct token expirations etc. Is there something like a timeout in prisma or anything that could cause this error? StackTrace:
    Copy code
    TypeError: Cannot read property 'paused' of undefined
    
        at onBodyTimeout (/home/patrick/Code/xxx/server/node_modules/@prisma/client/runtime/index.js:24829:16)
        at callTimer (/home/patrick/Code/xxx/server/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js:423:24)
        at doTickInner (/home/patrick/Code/xxx/server/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js:894:29)
        at Immediate.nextPromiseTick (/home/patrick/Code/xxx/server/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js:955:25)
        at processImmediate (internal/timers.js:461:21)
        at process.topLevelDomainCallback (domain.js:144:15)
        at process.callbackTrampoline (internal/async_hooks.js:129:14)
    r
    • 2
    • 7
  • t

    Taylor Preston

    07/28/2021, 6:01 PM
    Hey guys! I love Prisma, but am having some many-many issues 🤓 https://github.com/prisma/prisma/discussions/8486 … Any help with be greatly appreciated.
    r
    • 2
    • 3
  • d

    David

    07/28/2021, 9:25 PM
    @Taylor Preston here is something that helped me a little bit

    https://www.youtube.com/watch?v=NQXX6seWi_c&ab_channel=willjw3▾

  • c

    Carlos Gomez

    07/28/2021, 9:56 PM
    is it possible to define a compound index with Postgresql as the database?
    r
    • 2
    • 3
  • k

    Kent C. Dodds

    07/28/2021, 10:32 PM
    I'm tracking reads of blog posts. Among other things, I track the post slug. I want to find the most popular blog posts and order them by their popularity. To do this I need to first count how many rows reference each post slug, and then order them by that count. Ultimately what I'm hoping for is an array of post slugs ordered by popularity. How would I go about doing this with prisma? EDIT: I think I figured it out. I have to sort it myself in JS, but that's fine. If I'm missing anything that would allow me to have postgres do this sorting for me that would be sweet, but I think this will work:
    Copy code
    const result = await prisma.postRead.groupBy({
        by: ['postSlug'],
        orderBy: { postSlug: 'asc', },
        _count: true,
        take: limit,
      })
    EDIT AGAIN: I think this won't work with a limit because we're not ordering by the count, but by the postSlug. Anyone know if it's possible to order by the slug? Otherwise I have to get all the data and then limit it.
    d
    t
    • 3
    • 7
  • r

    Reid Ashwill

    07/28/2021, 11:50 PM
    Hello! I am kind of shooting in the dark here, but I am looking for a way to make a call to our db, and add the return to the context object every time it is created. Is this do-able? If so, is this a bad idea?
    r
    • 2
    • 1
  • p

    propagandalf

    07/29/2021, 12:09 AM
    Is it intentional that things like
    AND
    &
    OR
    on the
    [Type]WhereInput
    doesn't exist for findUnique() - but it does for findFirst()? I'm sitting with a specific usecase where I'd like to avoid using findFirst, because findUnique is perfect for the use case. It really doesn't matter, just curious as to why exactly it isn't universally added.
    d
    • 2
    • 1
  • g

    Gelo

    07/29/2021, 3:16 AM
    Sometimes migrate dev and generate doesn't detect new defined schema
    r
    n
    • 3
    • 8
  • g

    Gelo

    07/29/2021, 11:12 AM
    Hmm does anyone also encounter this when changing schema. I already tried to restart the app
    n
    • 2
    • 6
  • m

    Marc

    07/29/2021, 11:35 AM
    Hello! I am adding support for Referential Actions to the prisma-dbml-generator. I noticed the field
    relationOnDelete
    is already available in the DMMF types, but I am missing the field
    relationOnUpdate
    . Additionally, I noticed that the default values for
    relationOnDelete
    (
    SetNull
    and
    Restrict
    ) are missing in the generator step, if not explicitly added to the schema. I wrote this into this issue. Should I create an issue in the prisma repo as well?
    r
    • 2
    • 3
  • v

    Vladi Stevanovic

    07/29/2021, 11:56 AM
    👋 Prisma is on the road! This August, Prismates will visit the meetups in Budapest, Warsaw, and Poznan. We're also hosting a free breakfast the morning after each meetup! ☕️🫖 If you're in one of those cities, join us to listen to quality talks, eat yummy foods and get free stickers! 🙌 After careful consideration of the local Covid-19 situation and event rules, we have chosen the three locations that offer the safest option for meetups, with proven partners whom we trust to help us ensure everyone follows best practices and has a fun evening. 😷 We know that no online event can match the sense of community that in-person events bring, so we'll consider more locations as the situation evolves! 👉 We will meet you here: 🇭🇺 [Aug 5 - 6:00 PM CEST] BudapestJS Meetup → https://www.meetup.com/budapest-js/events/279338896/ 🇭🇺 [Aug 6 - 8:00 AM CEST] Budapest Breakfast with Prisma → https://www.meetup.com/budapest-js/events/279753672/ 🇵🇱 [Aug 11 - 6:30 PM CEST] WarsawJS Meetup → https://www.meetup.com/WarsawJS/events/279732973/ 🇵🇱 [Aug 12 - 9:00 AM CEST] Warsaw Breakfast with Prisma → https://www.linkedin.com/events/warsawbreakfastwithprisma6826456242366533632/ 🇵🇱 [Aug 12 - 6:00 pm CEST] Meet.js Poznan → https://www.meetup.com/meet-js-Poznań * *Event registration link will be announced soon 🇵🇱 [Aug 13 - 8:00 AM CEST] Poznan Breakfast with Prisma → https://www.linkedin.com/events/poznanbreakfastwithprisma6826457061165985792/
    🙌 2
    🇭🇺 2
    🇵🇱 2
    ☕ 2
    • 1
    • 2
  • v

    Vladi Stevanovic

    07/29/2021, 11:57 AM
    🙌 2
  • k

    khareta

    07/29/2021, 1:24 PM
    Can anybody help with this?
    [GraphQL error]: Message: Unknown object type "promise"
    https://github.com/MichalLytek/type-graphql/discussions/964
  • a

    Ahmar Suhail

    07/29/2021, 1:26 PM
    Hey, I have an AWS ECS task with 1vcpu which is using prisma. Does that mean it has 1 core, so prisma only has 3 connections?
    k
    r
    • 3
    • 5
  • d

    Daniel Olavio Ferreira

    07/29/2021, 1:49 PM
    Hey, anyone from the prisma team could help? I'm building a website and I want to display code snipets with syntax highlight. I'm using prismjs to do so, but I can't seem to find a way to support the .prisma files. How did you guys do it in the website?
    r
    • 2
    • 2
  • a

    Ankit Singh

    07/29/2021, 2:14 PM
    Hello Prisma, Is there any way to exclude the relation name but get the content inside it? Like here
    traineeUser
    is also coming with the data but i want to include its content. Idk if i am missing anything here!?
    r
    • 2
    • 2
  • a

    Anders

    07/29/2021, 2:55 PM
    Hi, I am trying to setup Prisma with GraphQL yoga, I wanted to connect to a local DB instance. I am using planetscale DB which is MYSQL, that is running locally on port 3306 with root as username and no password. When I run prisma init it asks me for the db host, db port, db user, and dp password which I leave blank. But it never asks me for my db name, and then it just says Done. I was able to get this working with Prisma Client and planet scale in a next js app. But from my understanding to get this working with graphQL yoga I need Prisma from prisma-binding, because I am going to do subscriptions. and that requires a endpoint which I thought prisma init would give me once I connected to my DB. Any thoughts on what I am doing wrong. Thanks ahead of time.
1...464465466...637Latest