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

    Cleyde Andrade

    07/26/2021, 1:16 PM
    Hi folks, someone have a example that upsert query with multiple keys
    r
    • 2
    • 10
  • h

    Halvor

    07/26/2021, 4:18 PM
    How can i query a table and check if it has an optional 1-to-1 relation with another table, and only return those rows?
  • h

    Halvor

    07/26/2021, 4:18 PM
    Copy code
    prisma.user.count({
            where: {
                have a 1-to-1 relation with "activation" table.
            }
        });
    p
    r
    • 3
    • 4
  • j

    Jakob Clausen

    07/26/2021, 5:27 PM
    Hey! Im pretty new to Prisma. Why do i get an error here? =>
    g
    r
    • 3
    • 3
  • j

    Jakob Clausen

    07/26/2021, 5:27 PM
    Models looks like this =>
  • j

    Jakob Clausen

    07/26/2021, 5:29 PM
    My goal is to have a one - to - one rel between user and gym and get the gym based on the userId.But it complained about not being able to get the gym because of userId being null. But i think i have userId as required, right?
  • u

    user

    07/26/2021, 7:05 PM
    What's new in Prisma (v2.28.0)

    https://www.youtube.com/watch?v=PptCfa73Y1k▾

    Daniel and Mahmoud from the Prisma team discuss news in the Prisma ecosystem. Tune in to learn about new releases, planned features, and other interesting bits from the Prisma world. Learn more about Prisma: ◭ Website: https://www.prisma.io​​​​ ◭ Docs: https://www.prisma.io/docs​​​​ ◭ Quickstart: https://www.prisma.io/docs/getting-started/quickstart
  • j

    Jeremy Scott

    07/26/2021, 7:23 PM
    Hey there, relatively new to Prisma. Is there a recommend way to insert a many to many relationship based off two previous inserts that both return unique ids. For example, insert a device and return the id, insert a boat and return the id, and then insert a provisonedDevice with two foreign keys as the boatId and deviceId. At any point of failure, I would want the complete transaction to fail (No device or boat to be inserted).
    c
    r
    • 3
    • 2
  • j

    Jeremy Scott

    07/26/2021, 7:24 PM
    I'm currently using knex as a replacement in this scenario, but would rather use Prisma if possible for type safety.
  • j

    jasci

    07/26/2021, 9:44 PM
    Hello everybody, maybe you can suggest some public prisma schemas and graphql schemas to take a look (with the source code). I mean some complex ones to get to know better how to model non-trivial relations, etc. Thought maybe someone has encountered those. Thank you.
  • b

    Brian Woodward

    07/26/2021, 10:39 PM
    Hello... I keep getting a
    ECONNREFUSED
    error from the prisma client when I deploy my app:
    Copy code
    Error: connect ECONNREFUSED 127.0.0.1:33941\n    at cb (/home/app/function/src/generated/prisma/client/runtime/index.js:34800:17)
    r
    • 2
    • 8
  • h

    Halvor

    07/27/2021, 12:36 AM
    Can i use numberics with prisma enums?
    r
    • 2
    • 4
  • w

    Wlad Paiva

    07/27/2021, 12:50 AM
    Hey team, I was using
    set
    to save the changes between two implict many-to-many relationship and it was working great but as soon as I changed it to explicit which will basically save the order between the other two models, it stop worked.
    Copy code
    model ModifiersOnItem {
      item    MenuItem          @relation(fields: [itemId], references: [id])
      itemId  String
      group   MenuModifierGroup @relation(fields: [groupId], references: [id])
      groupId String
      order   Int
    
      @@id([itemId, groupId])
    }
    The
    set
    doesn’t reflect the same functionality which is ok but now I’m wondering what would be the best approach for this scenario? Where do I have to update the relation between them and the order? Should I delete all records and add new set again? Something like this, would be cool to have:
    Copy code
    const item = await prisma.menuItem.update({
            where: {
              id: params.id,
            },
            data: {
              ...data,
              modifiers: {
                set: [
                  {
                    // groupId: '',
                    // order: ''
                  },
                ],
              },
            },
          })
    r
    • 2
    • 3
  • l

    Laurence Davies

    07/27/2021, 6:52 AM
    Hey Guys 👋 does anyone have experience implementing prisma in an existing typedi/type-graphql/typeorm app? I've got the go-ahead from my company to start incrementally replacing typeorm, and I'm trying to figure out the best way to initialise the client - would doing it as a global object like this best the best way: https://www.prisma.io/docs/support/help-articles/nextjs-prisma-client-dev-practices? Or would it be better to create a typedi service and inject it everywhere the client needs to be used? Any advise would be greatly appreciated 😊
    r
    • 2
    • 1
  • a

    alisalimli

    07/27/2021, 8:18 AM
    can someone help me ?
    d
    • 2
    • 2
  • p

    Paul

    07/27/2021, 11:37 AM
    Hey anyone on the Prisma dev team? How is this issue going? I'm stuck on 2.20 and my issue count is growing the more features I use. https://github.com/prisma/prisma/issues/7097
    r
    • 2
    • 2
  • n

    Naotho Machida

    07/27/2021, 12:23 PM
    Hi guys, Error: `The table
    publicProducts
    does not e exist in the current database.` The table publicProducts is ok in mySQL, the model publicProducts is also created In my pc, ok... I can GET the data, but in AWS I received this error How I can solve it? 😢😢
    ✅ 1
    r
    a
    • 3
    • 31
  • a

    alisalimli

    07/27/2021, 1:50 PM
    is there any problem if i install prisma dependency as normal dependecy(not dev dependency i mean)
    r
    • 2
    • 23
  • a

    alisalimli

    07/27/2021, 1:51 PM
    ?
  • a

    Alex Okros

    07/27/2021, 1:57 PM
    Does anyone know where I can install the prisma engine executables directly? (introspection, migration, query, and prisma-fmt)? I’m on a mac and for an installation I’m doing, I need the
    rhel
    engines to make it work.
    r
    j
    • 3
    • 6
  • d

    David

    07/27/2021, 4:23 PM
    Hello all!
  • d

    David

    07/27/2021, 4:23 PM
    Is this the right place to ask some question on prisma?
    👍 1
    👍🏻 1
    r
    • 2
    • 1
  • c

    Chris Tsongas

    07/27/2021, 4:46 PM
    I'm using Postgres and declaring my IDs as
    id String @id @db.Uuid
    as I like having the option to generate IDs programmatically (even on the client) before doing an insert, however I'm considering switching to
    id String @id @default(uuid()) @db.Uuid
    so I don't HAVE to supply an ID every time I do an insert. Just want to confirm I'd still be able to supply an ID generated programmatically when doing an insert?
    r
    • 2
    • 1
  • c

    Chris Tsongas

    07/27/2021, 4:59 PM
    One other question, if I want to start over by completely wiping my database and creating a brand new initial migration file what's the easiest way to go about that?
    r
    • 2
    • 1
  • g

    Giorgio Delgado

    07/27/2021, 6:37 PM
    Is there a way to programmatically do the same thing as the
    prisma
    CLI? Specifically I am looking to run
    npx prisma migrate deploy
    but programmatically
  • g

    Giorgio Delgado

    07/27/2021, 6:38 PM
    i guess i could issue shell commands in Node or any other language, and I could set
    DATABASE_URL
    for that program
  • g

    Giorgio Delgado

    07/27/2021, 6:41 PM
    Copy code
    var shell = require('shelljs');
    
    shell.exec(`DATABASE_URL=${BASE_DB_URL}/${autogeneratedSchemaName} npx prisma migrate deploy`);
    r
    • 2
    • 1
  • g

    Giorgio Delgado

    07/27/2021, 7:14 PM
    … on a related note, can I have multiple instances of a
    PrismaClient
    running? Each instance would connect to a different database
    r
    • 2
    • 1
  • a

    Agustín T

    07/27/2021, 7:23 PM
    const salones = await prisma.salones.findMany({       include: {         docentes_reservas_salones: {           select: {             docentes_reservas_docentes_reservasTodocentes_reservas_salones_codigo_reserva:               {                 select: {                   reservas: {                     select: {                       hora_inicial: true,                     },                   },                 },               },           },         },       },     }); Hello, does anyone know how to filter with a where in the include hora_inicial (start_time) field? Thanks!
    r
    • 2
    • 1
  • n

    Neo Lambada

    07/27/2021, 7:55 PM
    Copy code
    const magicFeedData = await models.sequelize.query(`
            select p.*,
                ${ user ? `exists(select 1 from SavedProduct sp where sp.productId = p.id and sp.userId = ${user.id} and sp.status = '1' limit 1) as "isBookmarked",`: ''}
                (select json_object(
                  'id', s.id,
                  'name', s.name,
                  'picture', s.picture,
                  'avatar', s.avatar,
                  'website', s.website,
                  'contact', s.contact,
                  'isVerified', s.isVerified,
                  'createdAt', s.createdAt,
                  'updatedAt', s.updatedAt)
                  from Shop s
                where s.id = p.shopId) as shop
            from Product p
            where p.stock >= 1
            order by p.id DESC ${limit_sql}
          `);
1...463464465...637Latest