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

    Kenny

    04/27/2022, 4:53 PM
    Hello, i am just starting to use Prisma and i'm confused about type inference, could not find any mentions about this in the docs so i don't know if i have something wrong? The thing is, if i use ``
    Copy code
    const test = await prisma.user.findMany();
    i don't have any type inference, and i can just type 'test' as anything i want. Is there something i can do so functions like this do type inference out of the box? I just have the "getting started" project, although it's in an express project and inside a mono-repository, so it might be an issue with our setup, or if i can't find the good page of the documentation. Thanks for any help!
    a
    n
    • 3
    • 5
  • o

    Om Ray

    04/27/2022, 5:14 PM
    Hi, I was wondering if anyone is working on this issue, and if not, if I could work on it https://github.com/prisma/prisma/issues/1994
    n
    • 2
    • 2
  • u

    user

    04/27/2022, 7:00 PM
    Build A Fullstack App with Remix, Prisma & MongoDB: CRUD, Filtering & Sorting 17 min read Welcome to the third article of this series where you are learning how to build a full-stack application from the ground up using MongoDB, Prisma, and Remix! In this part, you will build out the main piece of the application which displays a user's kudos feed and allows them to send kudos to other users.
    prisma cool 1
  • m

    Mubarak Shabel

    04/27/2022, 8:37 PM
    hello @everyone, I’m stuck pushing db to mongodb https://app.warp.dev/block/UAbc7luBxtMamulOWk2iNs
  • m

    Mubarak Shabel

    04/27/2022, 8:38 PM
    here it is
    a
    • 2
    • 1
  • m

    Mubarak Shabel

    04/27/2022, 8:41 PM
    and this is my schema
  • f

    friebetill

    04/27/2022, 10:19 PM
    Has anyone managed to get Prisma running in Docker on a AWS EC2 Graviton instance? My Dockerfile looks like this:
    Copy code
    # To reduce the image size we use a multi-stage build approach, see <https://bit.ly/3vMZjNu>.
    ### First stage ###
    FROM node:lts AS builder
    
    RUN apt-get install -y curl openssl
    
    WORKDIR /app
    
    COPY ./yarn.lock ./package.json ./
    
    RUN yarn install --frozen-lockfile
    
    COPY . .
    
    RUN yarn prisma:generate
    RUN yarn build
    
    RUN npm prune --production
    
    ####################
    
    ### Second stage ###
    FROM alpine:3.14.0
    
    RUN apk add --update nodejs
    
    RUN addgroup -S node && adduser -S node -G node
    
    USER node
    
    WORKDIR /home/node/app
    
    COPY --from=builder --chown=node:node /app ./
    
    EXPOSE 3000
    
    CMD ["node", "dist/src/main.js"]
    The error message is:
    Copy code
    UnhandledPromiseRejectionWarning: Error: Unknown PRISMA_QUERY_ENGINE_LIBRARY undefined. Possible binaryTargets: darwin, darwin-arm64, debian-openssl-1.0.x, debian-openssl-1.1.x, rhel-openssl-1.0.x, rhel-openssl-1.1.x, linux-arm64-openssl-1.1.x, linux-arm64-openssl-1.0.x, linux-arm-openssl-1.1.x, linux-arm-openssl-1.0.x, linux-musl, linux-nixos, windows, freebsd11, freebsd12, openbsd, netbsd, arm, native or a path to the query engine library.
    You may have to run prisma generate for your changes to take effect.
        at Object.getPlatform (/home/node/app/node_modules/@prisma/client/runtime/index.js:36103:13)
        at async Object.instantiateLibrary (/home/node/app/node_modules/@prisma/client/runtime/index.js:36094:21)
    But I have already tried setting
    binaryTargets
    to different values, e.g.
    debian-openssl-1.1.x
    for ubuntu 20.04 Unfortunately, nothing helped. Does anyone have a tip?
    n
    • 2
    • 6
  • u

    user

    04/27/2022, 11:38 PM
    πŸ‘‰ Build A Fullstack App with Remix, Prisma & MongoDB: CRUD, Filtering, and Sorting --

    https://www.youtube.com/watch?v=Mx9Xsq9JNXoβ–Ύ

    -- In this video, you'll continue forward on the kudos application by adding the main functionality: the kudos feed. You will add the main home screen with a list of users, a feed of kudos you have received, and a list of the site's most recent users. You will also add a form that allows you to send kudos to other users. β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” πŸ‘‰ More videos from this series β€’ Previous: Build A Fullstack App with Remix, Prisma & MongoDB: Project Setup |

    https://youtu.be/4tXGRe5CDDgβ–Ύ

    β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” πŸ“š Learn more about Prisma β€’ Website: https://www.prisma.io β€’ Docs: https://www.prisma.io/docs β€’ Quickstart: https://pris.ly/qstart β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” ❓ Get help with Prisma issues β€’ Slack: https://slack.prisma.io β€’ GitHub: https://www.github.com/prisma/prisma/discussions β€’ Stackoverflow: https://stackoverflow.com/questions/tagged/prisma β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” πŸ’¬ Follow Prisma on social media β€’ Twitter: https://twitter.com/prisma β€’ Instagram: https://www.instagram.com/prisma.io/ β€’ TikTok: https://www.tiktok.com/@prismadata β€’ Facebook: https://www.facebook.com/prisma.io β€’ LinkedIn: https://www.linkedin.com/company/prisma-io β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” πŸ” Professional captions for your technical videos Prisma sponsors human-reviewed, professional closed captions for ANY video valuable to our community (for example, about: Node.js, TypeScript & Type Safety, Prisma, databases, etc). Get your FREE captions here: https://pris.ly/closedcaptions β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” βœ… Subscribe to Prisma's YouTube channel https://www.youtube.com/channel/UCptAHlN1gdwD89tFM3ENb6w?sub_confirmation=1
    prisma rainbow 2
  • a

    Avi Block

    04/28/2022, 7:31 AM
    Copy code
    const usersWithCount = await prisma.user.findMany({
      select: {
        _count: {
          select: { posts: true },
        },
      },
    })
    this code example from the docs gets the post count for each user how would get, lets say, the count of published posts?
    n
    • 2
    • 1
  • s

    Szabi Hetei-Bako

    04/28/2022, 7:31 AM
    Hello Guys. I am Szabi from Germany. Working as a frontend developer.
    πŸ‘‹ 3
    n
    • 2
    • 1
  • u

    user

    04/28/2022, 8:08 AM
    πŸ‘‰ Build A Fullstack App with Remix, Prisma & MongoDB: Referential Integrity and Image Uploads --

    https://www.youtube.com/watch?v=ojatNgYa7Nwβ–Ύ

    -- In this video, you will build the profile settings section of your application, including an image upload component, and configure your schema to provide referential integrity in your data. β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” πŸ‘‰ More videos from this series β€’ Previous: Build A Fullstack App with Remix, Prisma & MongoDB: CRUD, Filtering, and Sorting |

    https://youtu.be/Mx9Xsq9JNXoβ–Ύ

    prisma rainbow 2
    πŸ’― 1
  • e

    ever0de

    04/28/2022, 8:24 AM
    hello. Is it possible to avoid the nested object pattern that occurs when using complex join queries? Too much depth makes it difficult to understand the code. Any good examples of this?
    n
    • 2
    • 12
  • u

    user

    04/28/2022, 8:30 AM
    Build A Fullstack App with Remix, Prisma &amp; MongoDB: Referential Integrity &amp; Image Uploads 12 min readWelcome to the fourth article of this series where you are learning how to build a full-stack application from the ground up using MongoDB, Prisma, and Remix! In this part, you will build the profile settings section of your application, including an image upload component, and configure your schema to provide referential integrity in your data.
    prisma rainbow 2
    prisma cool 2
  • s

    Shivam Singh

    04/28/2022, 9:55 AM
    I have a model with these 2 properties. When doing
    prisma.create
    on this model do I need to provide both
    createdBy
    and
    owner
    or either of them?
    n
    • 2
    • 3
  • p

    Paul

    04/28/2022, 10:06 AM
    Hey all. I have the following query, is it possible to do with Prisma?
    Copy code
    select id, name, "categoryId", a."createdAt" from forum_post fp 
    inner join (select "postId", max("createdAt") as "createdAt" from forum_post_reply group by "postId") a on a."postId" = fp.id 
    order by a."createdAt" desc;
    Thanks
    n
    • 2
    • 2
  • v

    Victor

    04/28/2022, 11:23 AM
    πŸ‘‹ Hey guys! I'm looking into Interactive Transactions and I have an operation that will occur very rarely, let's say 1/min. This operation will perform a number of requests to the database. The total time of this operation takes 10+ seconds. To my understanding I can change
    maxWait
    and
    timeout
    to support this case. However, I read that you should "*use interactive transactions with caution",* which is why I'm reaching out to you guys. Is it fine for me to set
    maxWait
    and
    timeout
    to higher values given the fact that this operation will occur quite rarely?
    For context I'm on a serverless environment with Vercel, and using PlanetScale for the database.
    a
    • 2
    • 3
  • d

    daemon

    04/28/2022, 2:01 PM
    Does someone know how to inspect the Types my schema is making dynamically? I can’t seem to wrap my head around what the client is expecting.
    a
    • 2
    • 1
  • d

    daemon

    04/28/2022, 2:01 PM
    And in docs it is unclear too
  • d

    daemon

    04/28/2022, 2:21 PM
    How would you update a model’s set of records if you have an
    Object[ ]
    with a
    unique field identifier
    and the column you want to update with the new value?
    n
    • 2
    • 1
  • d

    daemon

    04/28/2022, 2:23 PM
    Or should I loop individually through each object and make the update one by one?
  • z

    ZB

    04/28/2022, 2:28 PM
    Does anyone have a good β€˜dev-> prod’ flow when it comes to updating schema without losing data? Especially with supabase?
    a
    n
    • 3
    • 3
  • z

    ZB

    04/28/2022, 2:29 PM
    I've read through the docs but just wanted to ask others to better shape my understanding and to take into account someone else's experience while using Prisma in production?
  • c

    Chris Bitoy

    04/28/2022, 3:28 PM
    I just got this error when I run
    npx prisma studio
    right after updating some fields in my
    model.schema
    file. The error says:
    Copy code
    Message: Error in Prisma Client request: 
    
    Could not parse URL of the datasource
      
    Query:
    {
      "modelName": "User",
      "operation": "findMany",
      "args": {
        "take": 100,
        "skip": 0,
        "select": {
          "id": true,
          "name": true,
          "email": true,
          "image": true,
          "emailVerified": true,
          "Role": true,
          "accounts": true,
          "profile": true,
          "Program": true,
          "sessions": true,
          "profileId": true,
          "Announcement": true,
          "announcementId": true
        }
      }
    }
    Copy code
    //.env (data proxy setup)
    MIGRATE_DATABASE_URL='<postgresql://me>...'
    DATABASE_URL='<prisma://aws-us-east>...'
    Steps to recreate error: 1. Updated schema file 2. Ran
    npx prisma db push
    3. Ran
    npx prisma studio
    Can you please help resolve?
    n
    • 2
    • 10
  • c

    Chris Gurba

    04/28/2022, 10:08 PM
    question: what’s the best way to create a column like this using prisma models?:
    Copy code
    CREATE TABLE color (
        color_id INT GENERATED BY DEFAULT AS IDENTITY 
        (START WITH 10 INCREMENT BY 10), // <- this column
        color_name VARCHAR NOT NULL
    );
    n
    • 2
    • 3
  • t

    Trieu Le

    04/29/2022, 12:33 AM
    Copy code
    model User {
      id         String  @id @default(cuid())
      name       String
    
    }
    
    model Chat {
      id String @id @default(cuid())
    
      user_id String
      user    User   @relation(fields: [user_id], references: [id])
    
      to_user_id String
      to_user    User   @relation(fields: [to_user_id], references: [id], name: "toUser")
    
      created_at DateTime @default(now())
      updated_at DateTime @updatedAt
    }
    hi how can I define a model chat relation to User . but i don't want User have reference to Chat
    n
    • 2
    • 1
  • s

    Seren_Modz 21

    04/29/2022, 3:35 AM
    does anyone know when composite types will get support for SQL databases (eg. PostgreSQL)?
    n
    • 2
    • 2
  • m

    muhajir

    04/29/2022, 4:12 AM
    Hey everyone, what's a good way to turn an implicit many to many relation to be explicit. I suddenly have a use where i need to do aggregate in the intermediate table. Thank you for making Prisma btw, this is awesome
    n
    • 2
    • 3
  • u

    user

    04/29/2022, 8:31 AM
    πŸ‘‰ Build A Fullstack App with Remix, Prisma & MongoDB: Deployment --

    https://www.youtube.com/watch?v=E2fy2tGKaYcβ–Ύ

    -- In this video, you will deploy the application you've been building using Vercel. β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” πŸ‘‰ More videos from this series β€’ Previous: Build A Fullstack App with Remix, Prisma & MongoDB: Referential Integrity and Image Uploads |

    https://youtu.be/ojatNgYa7Nwβ–Ύ

    πŸ‘ 2
    prisma rainbow 1
  • u

    user

    04/29/2022, 9:20 AM
    Build A Fullstack App with Remix, Prisma &amp; MongoDB: Deployment 10 min readWelcome to the last article of this series where you are learning how to build a full-stack application from the ground up using MongoDB, Prisma, and Remix! In this part, you will deploy the application you've been building using Vercel.
    prisma rainbow 1
  • j

    James

    04/29/2022, 11:35 AM
    Hi all, I'm trying to have a dynamic relationship, how would you go about handling this in schema.prisma? An example would be allowing a User to share an Image or a Bookmark to another User. We currently have a Sharing table that has a contact_id but also a entity_id and entity_type (ENUM).
    n
    • 2
    • 2
1...568569570...637Latest