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

    Danny

    11/20/2021, 2:44 AM
    https://www.prisma.io/docs/reference/api-reference/prisma-client-reference#create-multiple-new-records
    Prisma Client does not yet support batch inserts at a database level. Follow issue #332 on GitHub for updates.
    Is this true? I had thought
    createMany
    was about "batch" inserts
    r
    • 2
    • 2
  • u

    李白字一日

    11/20/2021, 6:02 AM
    how to smoothly sync existing database with prisma without losing data?
    👀 2
    r
    • 2
    • 9
  • p

    Pieter

    11/20/2021, 10:42 AM
    @Joël thanks for this PR It does not seem to be working though. Am I missing something? I tried `PRISMA_SKIP_POSTINSTALL_GENERATE=true`and
    PRISMA_SKIP_POSTINSTALL_GENERATE=1
    but its still generating on postinstall (which fails as we got a monorepo so cant define the schema path in package.json)
  • m

    Michael Auderer

    11/20/2021, 8:56 PM
    how do you all handle prisma migrations in CI/CD with multiple environments? should I have my CI/CD run a prisma command in staging/prod branches to run the migrations that were created in dev? or should I be doing migrations manually?
    c
    • 2
    • 1
  • n

    Noel Martin Llevares

    11/21/2021, 1:14 AM
    How do I specify username, password, db host, and db name individually instead of one DATABASE_URL?
    Copy code
    datasource db {
      provider = "postgresql"
      url      = env("DATABASE_URL")
    }
    j
    r
    • 3
    • 8
  • b

    Blakelock Brown

    11/21/2021, 5:39 AM
    I highly doubt anyone from the Prisma team is still awake at this hour, but if someone is, can I please get some help? Vercel isn't loading my prisma.schema for some reason and it's breaking production EDIT: NVM GOT IT TYVM ✅
    n
    • 2
    • 3
  • s

    Shawn Williams

    11/21/2021, 7:00 AM
    I want to add a new database provider to prisma. Which entry point do I start to check?
  • h

    Hei

    11/21/2021, 8:20 AM
    Hi, How do I group and sum records within Implicit Many to Many. Currently I have a working prisma query but I wonder if there's another way in it.
    Copy code
    const countTags = await ctx.prisma.tag.findMany({
        select: {
          name: true,
          _count: {
            select: {
              questions: true,
            },
          },
        },
      });
    Since its implicit I cannot call the third table to query it directly. Here's my schema:
    Copy code
    model Question {
      id        Int      @id @default(autoincrement())
      title     String
      content   String
      tags      Tag[]
    }
    
    model Tag {
      id   Int    @id @default(autoincrement())
      name String @unique
      questions Question[]
    }
    r
    • 2
    • 2
  • j

    Jin

    11/21/2021, 2:48 PM
    Does someone know why “brave_easley” server cannot access “whisperserver-postgreddb” ?
    r
    • 2
    • 1
  • g

    Garrick Chippendale

    11/22/2021, 12:10 AM
    Copy code
    collectionLogBank          Json     @default("{}") @db.Json
    
    @@index([collectionLogBank], map: "cl_jsonb")
    Error: db error: ERROR: data type json has no default operator class for access method "btree" HINT: You must specify an operator class for the index or define a default operator class for the data type. 0: sql_migration_connector:sql database step applier:apply_migration at migration-engine\connectors\sql-migration-connector\src\sql_database_step_applier.rs:11 1: migration_core:api:SchemaPush at migration-engine\core\src\api.rs:184 any idea for this error?
  • g

    Garrick Chippendale

    11/22/2021, 12:28 AM
    I think ive narrowed it down to this issue: https://github.com/prisma/prisma/issues/7410
    👍 1
  • t

    Timo

    11/22/2021, 9:20 AM
    I've got items that I want to order based on the timestamp (descending) and a score (descending).
    Copy code
    orderBy = [
     {
       timestamp: 'desc',
     },
     {
       score: {value: 'desc'},
     },
    ]
    When I set timestamp first, it just orders by timestamp it seems. And when I set score first, it shows the oldest with the highest score. But I want the newest ones with the highest scores. How do I do that?
    r
    m
    • 3
    • 13
  • s

    Sai Raj

    11/22/2021, 9:27 AM
    yarn run v1.22.5 s2media_server    | $ yarn prisma:generate && yarn dev s2media_server    | $ npx prisma generate s2media_server    | Environment variables loaded from .env s2media_server    | Prisma schema loaded from prisma/schema.prisma s2media_server    | Error: Can't write to /app/node_modules/prisma please make sure you install "prisma" with the right permissions. s2media_server    | npm notice s2media_server    | npm notice New major version of npm available! 7.7.6 -> 8.1.4 s2media_server    | npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.1.4> s2media_server    | npm notice Run 
    npm install -g npm@8.1.4
     to update! s2media_server    | npm notice s2media_server    | error Command failed with exit code 1. s2media_server    | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. s2media_server    | error Command failed with exit code 1. s2media_server    | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. I am getting this error all of a sudden, and I have no clue what's wrong with Prisma, I am using 
    docker-compose
    here is the repo I am working on https://github.com/sairaj2119/s2media can someone help me
    r
    • 2
    • 6
  • u

    user

    11/22/2021, 12:33 PM
    Building Applications At The Edge For Fun And Profit - Greg McKeon - Prisma Serverless Conference

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

    Exploring Prisma’s new Data Proxy announcement and how it can be combined with Cloudflare’s Workers platform to build applications that scale globally, without tuning or managing infrastructure. 🗣️Speaker: Greg McKeon At Cloudflare, Greg works with customers to define storage products that are radically easier to use than traditional cloud provider solutions. Prior to Cloudflare, Greg worked at Red Hat and MongoDB on their OpenShift and core database teams respectively. Connect with Greg: https://twitter.com/wegmckeon 📣 Prisma Serverless This talk has been recorded at the Prisma Serverless Conference on November 18, 2021. You can learn more about the Prisma Data Platform here: www.prisma.io/dataplatform
  • i

    Ivan Lukianchuk

    11/22/2021, 9:21 PM
    Been running in production for a few weeks no problem, haven't touched a thing, and now it seems like all my api calls on Vercel that use Prisma have been timing out, yet my AWS RDS db seems to have no errors or weird things. Anyone encounter anything like this?
    r
    a
    • 3
    • 14
  • c

    Charles Gaudreau Jackson

    11/22/2021, 10:53 PM
    Hi! I’m following the tutorial at https://www.howtographql.com/ - react-apollo/nodejs-apollo. At the end of the tutorial, there aren’t any instructions on how to deploy the app into production. Could anyone please point to me where I can learn to do that the right way? Thank you!
    r
    • 2
    • 1
  • j

    Jake Choi

    11/23/2021, 1:22 AM
    Hi! I'm using prisma & mysql for our team's server. Yesterday, "Prepared_stmt_count" exceeded default "max_prepared_stmt_count" value. Is there any way I can control prepared statement? or I have to keep increasing max value? Thank you!
    👍 1
    👀 1
    r
    • 2
    • 3
  • a

    Abdurrahman

    11/23/2021, 5:58 AM
    https://ref.remotesome.com/talent?code=2X07AV
  • a

    Awey

    11/23/2021, 7:40 AM
    Copy code
    model Comment {
      id        Int       @id @default(autoincrement())
      createdAt DateTime  @default(now()) @map("created_at")
      updatedAt DateTime  @updatedAt @map("updated_at")
      content   String
      author    User      @relation(fields: [authorId], references: [id])
      authorId  Int       @map("author_id")
      post      Post      @relation(fields: [postId], references: [id])
      postId    Int       @map("post_id")
      parent    Comment?  @relation("CommentToComment", fields: [parentId], references: [id])
      parentId  Int?      @map("parent_id")
      replies   Comment[] @relation("CommentToComment")
    
      @@map("comments")
    }
    
    type Comment {
      id: Int!
      createdAt: DateTime!
      updatedAt: DateTime!
      content: String!
      author: User!
      post: Post!
      parent: Comment
      replies: [Comment!]
    }
    Am I representing my Prisma Model correctly with GraphQL?
    r
    • 2
    • 1
  • u

    user

    11/23/2021, 10:02 AM
    Serverless Apps At Scale With Prisma Data Proxy And MongoDB Atlas Serverless - Kevin Jernigan

    https://www.youtube.com/watch?v=dv8t-EWY9HU▾

    In this presentation, we will describe MongoDB Atlas Serverless, and review how Prisma Data Proxy can be used together with MongoDB Atlas to implement large-scale serverless applications. We will also cover new MongoDB Atlas capabilities which can help with serverless applications, and we will show a brief demo of Prisma Data Proxy with MongoDB Atlas Serverless. 🗣️Speakers: Kevin Jernigan and Matt Mueller Kevin Jernigan is a Principal Product Manager at MongoDB. Kevin started his career at Oracle in 1987, as a product manager. Prior to joining MongoDB, he was a Principal Product Manager responsible for Amazon Aurora PostgreSQL. Connect with Kevin: https://www.linkedin.com/in/kevinjernigan/ 📣 Prisma Serverless This talk has been recorded at the Prisma Serverless Conference on November 18, 2021. You can learn more about the Prisma Data Platform here: www.prisma.io/dataplatform
  • u

    user

    11/23/2021, 11:28 AM
    Prisma Chats with Shanon Jackson - end-to-end type safety with Next.js and Prisma

    https://www.youtube.com/watch?v=ur-SYNqADTY▾

    In this video, Daniel from the Prisma team interviews Shanon Jackson Shanon Jackson is the Software Engineering Chapter Lead at Qrious based in Auckland, New Zealand. He’s been using Typescript for over 6 years in production and his recent work revolves around production use-cases for the Typescript compiler itself. In his spare time, Shanon can be found working on his side hustle Flack, a peer-to-peer rental platform. He also enjoys hiking the many tracks in his home country of New Zealand. They discuss the following topics: - How Shanon uses Prisma - Shanon's technology stack in his projects and collaboration approach - How Shanon and his team at Qrious approach end-to-end type safety with Prisma and Next.js by solely relying on the TypeScript compiler. Timestamps: 0000 Introduction 0033 How Shanon uses Prisma and the value it provides them 0447 How collaboration and development workflows look like on Prisma projects at Qrious 0715 TypeScript best practices and the balance between type checking and testing 1049 Runtime validation and type safety 1320 Shanon's tech stack: Next.js, serverless 1705 Deployment platforms, Vercel, AWS and VPC Peering 1922 API technologies: REST and GraphQL 2135 Databases Shanon uses: PostgreSQL, MongoDB, SQL Server 2511 Team structure, full-stack development and Prisma 2809 DEMO: How Shanon achieves end-to-end type safety with Next.js API routes and Prisma.
  • o

    Oleg Komarov

    11/23/2021, 12:25 PM
    @Ryan I created a feature request for Filtering JSON scalar path with IN condition unless this is somehow already possible (other than the alternative suggested in the Github issue)?
    r
    • 2
    • 1
  • j

    James Pickard

    11/23/2021, 1:45 PM
    I am struggling a little bit to understand the correct workflow. I want to add a unique index to a field. Should I modify schema.prisma then do something to generate a migration?
  • j

    James Pickard

    11/23/2021, 1:45 PM
    I would find it more natural to modify my database and have Prisma figure out the changes required
  • j

    James Pickard

    11/23/2021, 1:49 PM
    ok, indeed, I was able to modify the schema directly then
    npx prisma db pull
    and that seems to have updated my schema.prisma but it hasn’t generated a migration, I don’t think
    r
    • 2
    • 12
  • b

    Benny

    11/23/2021, 3:00 PM
    Hi! I have 2 models with 1 to many relationships:
    Copy code
    model User {
        id          String @id
        ownership   Ownership[]
    }
    
    model Ownership {
         id    String @id @default(cuid())
         user        User? @relation(fields: [userId], references: [id])
         userId      String
         createdAt   DateTime @default(now())
    }
    When i query a user, i want to return only 1 ownership:
    Copy code
    prisma.user.findUnique({
          where: {
            id: userId,
          },
          include: {
          ownership: {
          take: 1,
          orderBy: {
            createdAt: 'desc',
          },
        },
      },
    })
    But i want the
    user.ownership
    will be an object, and not array of 1
    ownership
    element. i.e
    Copy code
    result.ownership = result.ownership[0];
    I want to do it for every query for User, so middleware seemed like the best approach but i can see how you can't mutate the return value of the query with middleware. Any ideas maybe?
    r
    • 2
    • 3
  • a

    Aydrian Howard

    11/23/2021, 3:29 PM
    Hello. Has anyone run into this problem deploying a Next.js app with Prisma to Netlify? The build fails with the following error:
    Copy code
    Module not found: Can't resolve '_http_common' in '/opt/build/repo/node_modules/@prisma/client/runtime'
    Not sure what's going on. It works in dev mode on my machine.
    • 1
    • 1
  • j

    James Pickard

    11/23/2021, 3:43 PM
    Hmm…
    Copy code
    import prismaClientPkg from '@prisma/client';
    const PrismaClient = prismaClientPkg.PrismaClient;
    a
    • 2
    • 3
  • j

    James Pickard

    11/23/2021, 3:44 PM
    Copy code
    ERROR  ServerMiddleware Error: Cannot read property 'PrismaClient' of undefined
  • d

    Dennis Yurkevich

    11/23/2021, 7:25 PM
    Hello All!
    🖐️ 1
    👋 1
1...510511512...637Latest