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

    Simon Sardorf

    06/26/2022, 5:52 PM
    Hey! Should the id of a table still increment if I get
    P2002
    ? Currently experiencing this EDIT: Just read up on it, and it’s a postgres “feature”
  • t

    Thomas Yankue

    06/26/2022, 6:50 PM
    Hi, I have a structure a bit like this
    Copy code
    model Thanks {
        target: string
        reason: string
    }
    with target being a user's name. I'm wondering how I can find the top 10 users that have the most thanks? Thank you.
    ✅ 1
    t
    • 2
    • 1
  • s

    Steven Stavrakis

    06/26/2022, 7:13 PM
    Anyone know what
    Copy code
    Type 'string | string[]' is not assignable to type 'string | StringFieldUpdateOperationsInput | undefined'.
      Type 'string[]' is not assignable to type 'string | StringFieldUpdateOperationsInput | undefined'.ts(2322)
    Is about? I'm not sure why the type is being defined with string[]
    👀 1
    t
    • 2
    • 1
  • w

    woolite

    06/26/2022, 9:15 PM
    Do I need to add someting to my tsconfig to be able to use types e.g.
    Prisma.XXXCreateInput
    . Currently compiler throws this error
    ✅ 1
    t
    • 2
    • 8
  • s

    ShadowPrompt

    06/26/2022, 11:08 PM
    I followed the tsed official document steps and the validate error message, then give the “author” with null, but got another error, why. The tsed suggest me to ask here, thx.
    👀 1
    a
    v
    • 3
    • 2
  • s

    Steven Inouye

    06/27/2022, 5:43 AM
    Reading the docs it looks like I can do a many-to-many relationship using an implicit relationship To my understanding there is no way to do this without using the implicit relation Can anyone confirm there is no way to create a many to many relationship without the implicit relationship? Here are 2 discussions asking for this feature https://github.com/prisma/prisma/issues/2186 https://github.com/prisma/prisma/issues/4910
    ✅ 1
    a
    • 2
    • 4
  • h

    Hussam Khatib

    06/27/2022, 2:45 PM
    Is there a way to store the type defined with enum as array in client
    Copy code
    enum Gender{
    M
    F
    Other
    }
    I want this in the client as
    Copy code
    const genders = ["M","F","Other"]
    without hardcoding.
    ✅ 1
    i
    r
    b
    • 4
    • 10
  • a

    AJ Holloway

    06/27/2022, 7:27 PM
    In general, are there any performance losses using findMany vs findUnique? I am building some dynamic tooling and an thinking of using findMany for every query since it can return one or multiple based on the where clause.
    h
    • 2
    • 1
  • p

    PinkiePie

    06/27/2022, 9:02 PM
    does prisma support batching? i can't find any docs on how to update multiple entries at once
    h
    n
    • 3
    • 5
  • c

    Chris Tsongas

    06/28/2022, 12:10 AM
    Any reason there isn't a
    notEquals
    ?
    notIn
    is so convenient.
    h
    • 2
    • 3
  • u

    user

    06/28/2022, 6:00 AM
    👉 What's new in Prisma (v4.0.0) --

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

    -- Niko and Sabin from the Prisma team discuss the latest 4.0.0 release of Prisma and other news from the Prisma ecosystem.
    prisma rainbow 2
  • v

    Vin Yap

    06/28/2022, 6:17 AM
    Is it possible to use stored procedures with prisma and planetscale? If not is there any alternative for this?
    👀 1
    a
    • 2
    • 3
  • b

    Björnstjerne Tiedemann

    06/28/2022, 6:51 AM
    Hello all, is it possible to use an environment variable as default value in prisma schema?
    ✅ 1
    a
    • 2
    • 1
  • t

    Takeo Kusama

    06/28/2022, 9:58 AM
    Can prisma generate rollback sql? Prisma migrate dev reset all migration if having conflict migration sql which not existed when finally run migration. If we fails migration for dev and want to re-migrate without dropping table data, currently possible solution is to run manually sql?
    ✅ 1
    i
    • 2
    • 3
  • k

    Kay Khan

    06/28/2022, 11:37 AM
    I have the following query, the total number of rows that are returned is 10,068. The query will not work as is and it will hang. However if i set "take: 10068". It works and returns under 1 second. Whats going on?
    Copy code
    const options: Prisma.brandFindManyArgs = {
                distinct: ["name"],
                select: {
                    id: true,
                    name: true,
                    website: true,
                    company_size_li: true,
                    image: {
                        select: {
                            id: true,
                            source: true,
                            dtype: true,
                        },
                    },
                },
                //take: 10068,
            };
    Copy code
    SELECT DISTINCT b.name, b.id, b.website, b.company_size_li, i.id, i.source, i.dtype
    FROM brand b
    JOIN image i ON i.id = b.image_id
    Copy code
    SELECT count(DISTINCT b.id) // 10068
    FROM brand b
    JOIN image i ON i.id = b.image_id
    ✅ 1
    n
    • 2
    • 7
  • m

    McKay Bonham

    06/28/2022, 11:55 AM
    Hi all, my Prisma schema is pretty simple and by-the-book so far, but it's already giving a Malformed ObjectID error when I try to use it. What am I missing?
    Copy code
    generator client {
      provider = "prisma-client-js"
    }
    
    datasource db {
      provider = "mongodb"
      url      = env("DATABASE_URL")
    }
    
    model User {
      id           String      @id @default(auto()) @map("_id") @db.ObjectId
      email        String      @unique(map: "email_1")
      name         String      @unique
      passHash     String
      privilege    Int
      createdAt    DateTime
      lastLogin    DateTime?
      campaigns    Campaign[]
      passcodes    String[]
      disabledCmp  String[]
    }
    
    model Campaign {
      id            String     @id @default(auto()) @map("_id") @db.ObjectId
      name          String     @unique
      creator       User       @relation(fields: [creatorId], references: [id])
      creatorId     String     @db.ObjectId
      fullPasscode  String
      pcPasscode    String
      description   String?
      createdAt     DateTime
    }
    👀 1
    j
    v
    • 3
    • 11
  • r

    Rajdeep singh

    06/28/2022, 1:16 PM
    Hi everyone
  • r

    Rajdeep singh

    06/28/2022, 1:17 PM
    Recently I have been facing an error with Prisma with all databases.
  • r

    Rajdeep singh

    06/28/2022, 1:18 PM
    Copy code
    npx prisma db push
    Environment variables loaded from .env
    Prisma schema loaded from prisma/schema.prisma
    Error: Get config: Unable to establish a connection to query-engine-node-api library
    
    Prisma CLI Version : 3.15.2
    ✅ 1
    n
    j
    • 3
    • 2
  • r

    Rajdeep singh

    06/28/2022, 1:21 PM
    I do not find any reason for what happens to me. Maybe I'm using ubuntu, and the wrong config setup does not work for me. tell me any idea how to solve it.
  • s

    Shmuel

    06/28/2022, 1:27 PM
    Hi, Is there a way to use a case statement in
    orderBy
    of prisma client? If not what are some ideas for workarounds? (I see this issue in the archived prisma repo https://github.com/prisma/specs/issues/128, but it was closed as completed, though I don't see docs for allowing case statements in the
    orderBy
    clause. This issue https://github.com/prisma/prisma/issues/10335 is in the current repo, but it's not so clear from the title that the feature request is for case statements. Maybe the title should be renamed to 'Support case statements in orderBy' like the first issue?)
    v
    • 2
    • 2
  • p

    Pieter

    06/28/2022, 2:56 PM
    Prisam 4.0 published on npm but no changelogs on github. not even a 4.x branch?
    ✅ 2
    n
    • 2
    • 2
  • d

    Dmitrii Kartashev

    06/28/2022, 3:23 PM
    Aint
    DbNull
    thing exactly the use case for Symbols? Why objects?
    ✅ 1
    a
    • 2
    • 1
  • j

    Jose Maria CL

    06/28/2022, 3:46 PM
    It would be nice to have a Prisma learning platform... you know.. like the https://odyssey.apollographql.com/ To have a set of basics for beginners, recommendations, how to decouple the orm from the domain layer... idk. Things I would like to know hehe
    ✅ 1
    n
    • 2
    • 2
  • m

    Michael Gates

    06/28/2022, 3:54 PM
    Defaults for scalars is great, good work team
    prisma rainbow 4
  • n

    Nditah Samweld

    06/28/2022, 4:05 PM
    How do I validate
    cuid
    generate by prisma as PrimaryKey
    Copy code
    model Picture {
      id          String    @id @default(cuid())
      page        String
      ...
      @@map(name: "picture")
    }
    
    import { InputType, Field, PartialType } from '@nestjs/graphql';
    import { IsNotEmpty, IsString, IsUUID } from 'class-validator';
    
    @InputType()
    export class UpdatePictureInput {
      @IsString()
      @Field(() => String, { description: 'PrimaryKey' })
      id: string;
    }
    👀 1
    n
    t
    • 3
    • 2
  • l

    luwol03

    06/28/2022, 5:34 PM
    Hello, could it be that there is a small mistake in the changelog? Take a look at the exception when no record is not found part on the new findUniqueOrThrow function very at the ending.
    👀 1
    a
    n
    • 3
    • 2
  • t

    Tanul

    06/28/2022, 6:08 PM
    Hello, I have query regarding Prisma showing vulnerabilities in ubuntu OS nodes. My ubuntu release is 18.04.6 LTS Bionic Beaver 1. Prisma is showing this vulnerability CVE-2022-1664.. in installed dpkg version 1.19.05 and suggesting to install 1.20.10... Where as this is already resolved in 1.19.05 as shown here https://ubuntu.com/security/CVE-2022-1664 2. ~Prisma is showing this vulnerability CVE-2022-1292.. in installed openssl version 1.1.1-1ubuntu2.1~18.04.19 and suggesting to install 1.1.1n-0+deb11u2.. Where as this is already resolved in 1.1.1-1ubuntu2.1~18.04.17 as shown here url ~
    j
    v
    • 3
    • 9
  • f

    Franco Roura

    06/28/2022, 6:23 PM
    Hey all 👋 If I do something like
    Copy code
    prisma.model.findFirst({
      where: {
        something,
      },
      orderBy: {
        updatedAt: 'desc',
      },
    })
    Will it sort before or after the limit clause? I mean, will it bring me the last updated record? Or just the first thing it finds?
    ✅ 1
    c
    • 2
    • 2
  • j

    James Johnson III

    06/28/2022, 6:31 PM
    I'm new to Prisma is there anybody that can help setup the API https://unlimitednow.me/index2
1...590591592...637Latest