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

    Halvor

    06/05/2022, 5:27 PM
    Hi, why is prisma when i run "prisma migrate dev" wanting to do a migration even though i did not change the prisma.schema file since last migration (when it was in sync) ? I get this in the migration file it generates:
    Copy code
    -- RenameIndex
    ALTER INDEX "Arbitrated_matchId_unique" RENAME TO "Arbitrated_matchId_key";
    Using this model:
    Copy code
    model Arbitrated {
        id         Int      @id @default(autoincrement())
        createdAt  DateTime @default(now())
        match      Match    @relation(fields: [matchId], references: [id])
        matchId    Int      @unique
        session_id String   @unique
        stats      Stat[]
    }
    ✅ 1
    n
    • 2
    • 5
  • h

    Halvor

    06/05/2022, 5:29 PM
    The field
    matchId
    is clearly a @unique and not a @id?
    n
    • 2
    • 1
  • a

    Alexander Hupfer

    06/05/2022, 5:38 PM
    Hi, I'm just switching to prisma after many years of SqlAlchemy. Things seem so easy in comparison. Why does SqlAlchemy need all the session handling stuff an prisma does not?
    ✅ 1
    n
    • 2
    • 3
  • a

    Alexander Hupfer

    06/05/2022, 5:40 PM
    I'm a bit worried that I'm missing something. Murphey's Law of Databases: "all database problems only appear in production"
  • m

    Manthan Mallikarjun

    06/06/2022, 1:14 AM
    Hello! Quick question about database design. Im working on an app which has notes and those notes can have multiple tags. Additionally, every note belongs to a user. So for example a user can create a note called Hello World with tags foo and bar. For this design, should I create a
    tags
    table which holds a user id and label, and then a
    NotesTagsJoinTable
    which takes a note id and a tag id? Or should I go simpler and just have a
    tags
    table which holds the label, user id and note id?
    ✅ 1
    n
    • 2
    • 3
  • j

    Jon

    06/06/2022, 4:11 AM
    I have several lists that share the same posts through a relation, so
    posts.findMany
    gets them all, but I also need to show them by list,
    lists.findUnique({where: listId, include: posts})
    This all works fine. I'm trying to implement a custom ordering of posts within each list, however. So
    listId: 1
    returns
    postId: 1, postId: 2
    and
    listId: 2
    returns
    postId: 2, postId: 1
    - this is over-simplified, but shows the behavior I'm after. I can't really store it on the
    post
    itself, as it's shared, so I think I may need to store it on the
    list
    but I'm not sure how it can be stored in a way that it can be sorted by. Any ideas how I can achieve this custom ordering of the same related data?
    ✅ 1
    n
    • 2
    • 2
  • k

    Keshav Tangri

    06/06/2022, 12:06 PM
    How can I use fragments in prisma 3 ? fragments were a part of prisma-bindings for v1, but I am unable to get docs for fragments for prisma v3
    plus one +1 2
    n
    m
    s
    • 4
    • 9
  • s

    Stephan Du Toit

    06/06/2022, 2:35 PM
    Hi Everyone, very new to Prisma. Just want to pick someones brain. I am using mongodb and trying to run a query that returns information from a relation:
    Copy code
    const packages = await prisma.services.groupBy({
        by: ["product"],
        where: {
          Status: true,
        },
        _count: {
          product: true,
        },
      });
    
    console.log("Packages", packages);
    Results:
    Copy code
    Packages [
      { _count: { product: 153 }, product: '5f147ee6770c7325aab150ce' },
      { _count: { product: 42 }, product: '5f147edd770c7325aab150cd' },
      { _count: { product: 80 }, product: '5f147f00770c7325aab150d0' },
      { _count: { product: 4 }, product: '5f147ecb770c7325aab150cc' },
      { _count: { product: 5 }, product: '5f147f0d770c7325aab150d1' },
      { _count: { product: 157 }, product: '5f147ef3770c7325aab150cf' }
    ]
    The product value returns the
    id
    instead of the actual record from related document / table. Is there a way to return the documents for
    products
    in the same prisma query?
    r
    k
    • 3
    • 12
  • v

    Vladi Stevanovic

    06/06/2022, 4:45 PM
    set the channel topic: General Discussions about Prisma [Looking for Prisma 1? Join the #prisma1 channel!] ✅ = Answered 👀 = Investigating / waiting for info 👋 = Welcome!
  • p

    prisma chobo

    06/06/2022, 5:17 PM
    Hello, I am trying to delete like thousands of records/data/rows using deleteMany , but it turns out that causing some kind of error or problem (I guess because of deleting too many data at once). Is there any recommendation on how to delete thousands of data without causing application performance?
    👀 1
    o
    n
    • 3
    • 3
  • p

    prisma chobo

    06/06/2022, 5:17 PM
    Thank you
  • a

    Alexander Hupfer

    06/06/2022, 7:24 PM
    I'm having two projects that share the same schema file and only differ in the generator used. Is there a way to decouple the generator from the schema file?
    ✅ 1
    n
    • 2
    • 1
  • h

    Halvor

    06/06/2022, 9:16 PM
    Is it impossible to do upsert on one-to-many relation ships when when i have a unique constraint? Schema:
    Copy code
    model UserHash {
        user     User     @relation(fields: [userId], references: [id])
        userId   Int
        platform Platform @default(PC)
        hash     String
    
        @@id(fields: [userId, platform])
        @@unique(fields: [platform, hash])
    }
    Error:
    Copy code
    Invalid `prisma.userHash.upsert()` invocation:
    
    
      An operation failed because it depends on one or more records that were required but not found. No 'User' record(s) (needed to inline the relation on 'UserHash' record(s)) was found for a nested connect on one-to-many relation 'UserToUserHash'.
    👀 1
    n
    • 2
    • 2
  • f

    femzy

    06/06/2022, 9:21 PM
    Please how do I set
    bio
    to
    not null
    Copy code
    model Profile {
      id      Int   @id @default(autoincrement())
      bio     String   @db.Text
      city    String   @db.VarChar(255)
    }
    ✅ 1
    m
    n
    • 3
    • 3
  • m

    Manuel Galván

    06/07/2022, 2:54 AM
    Where can I get examples of graphql inputs for prisma generated inputs and dto????
    ✅ 1
    n
    • 2
    • 1
  • l

    Luisfer

    06/07/2022, 3:08 AM
    hi is it possible to introspect a psql
    COMMENT
    as a comment in the prisma schema?
    ✅ 1
    • 1
    • 1
  • n

    Nilay Kothari

    06/07/2022, 5:32 AM
    Hey, We are performing load test before going live and observed one thing that after one iteration it takes around
    18 minutes
    to release active connection. • can someone guide or explain this behavior? • According to me once query is executed, it should release connection Note: Using 3.14.0 version
    ✅ 1
    n
    • 2
    • 1
  • r

    Rhiannon Williams

    06/07/2022, 7:18 AM
    Hi! Is there any indication of when the postgresql fulltextsearch will move out of Preview mode?
    ✅ 1
    n
    • 2
    • 2
  • a

    Aarav Shah

    06/07/2022, 8:41 AM
    Hello! @Nurul I am storing number value as string inside the DB '123' Now I want to apply filtering on this column
    ✅ 1
    n
    • 2
    • 5
  • m

    Mykyta Machekhin

    06/07/2022, 11:44 AM
    Hello guys, is there way to say prisma throw error when try to update unique row, but row not exist? Like when try to find unique row with rejectOnNotFound flag
    ✅ 1
    n
    • 2
    • 1
  • k

    KIM SEI HOON

    06/07/2022, 12:21 PM
    Hello, it takes a lot of time to do RDS (AWS) INSERT on prisma2. It is a situation in which data is put into other tables using include inside prisma2. Once you do INSERT, you get a long request time of 7 to 14 seconds. In order to solve this problem, would it be better to refrain from using prisma include and INSERT one by one with different logic? 🙏(The database load is quite low)
    👀 1
    n
    • 2
    • 1
  • r

    Richard

    06/07/2022, 1:53 PM
    Does Prisma support ULID? https://github.com/ulid
    ✅ 1
    n
    • 2
    • 3
  • u

    user

    06/07/2022, 3:21 PM
    👉 What's new in Prisma (v3.15.0) --

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

    -- Tasin and Alex from the Prisma team discuss the latest 3.15.0 release of Prisma and other news from the Prisma ecosystem.
    prisma rainbow 2
    🙌 2
  • s

    sagar lama

    06/07/2022, 5:45 PM
    has anyone implemented polymorphic relations in prisma?
    ✅ 1
    👀 1
    a
    • 2
    • 1
  • e

    Ekansh Vinaik

    06/07/2022, 6:46 PM
    hey all — using prisma+seed and having trouble including the
    schema.prisma
    in the .zip package generated we’re using
    packages.individually=true
    ,
    packages.pattern=./schema.prisma
    . Using those, the output is like:
    lambda.zip
    expanded: • schema.prisma • subfolder/ ◦ sub subfolder/ ▪︎ index.js ▪︎ index.js.map and I get an error that
    schema.prisma
    isn’t found in
    sub subfolder
    . any way to include that
    schema.prisma
    file down there/does anyone know what the best way to include
    .prisma
    files is here? we’re using
    serverless-esbuild
    + seed
    👀 1
    a
    • 2
    • 3
  • v

    Vyrek XD

    06/07/2022, 9:49 PM
    is there a specific way to get the ping of the DB using prisma? or the only way is just getting a document
    ✅ 1
    n
    • 2
    • 1
  • r

    Rahul Taing

    06/07/2022, 10:15 PM
    is it possible for me to specify a custom location and file name for
    .env
    file instead of what is mentioned here. some way to provide the updated dotenv config path to the prisma client. something like this:
    Copy code
    dotenv.config({
      path: path.resolve('./my/custom/env/config/path'),
    });
    ✅ 1
    n
    • 2
    • 4
  • g

    Gelo

    06/08/2022, 7:15 AM
    what is the difference of
    {some-property: {equals: some-data}} to {some-property: some-data}
    which is better?
    ✅ 1
    h
    • 2
    • 3
  • o

    Oscar Stahlberg

    06/08/2022, 8:38 AM
    👋 Hello, I am new to Prisma. Looking forward to integrate it into our backend. I have a technical question about using Prisma in a Kubernetes-based setup, where should I ask that? 😃
    ✅ 1
    n
    r
    • 3
    • 2
  • b

    Bastien Etienne

    06/08/2022, 8:54 AM
    hellot, i'm new to prisma and i have question it is possible to nested relation query with upsert ? somehting like this :
    Copy code
    const updateUser = await prisma.cibest_user.upsert({
              where: {
                email: props.email,
              },
              update:{
                tokens:{
                    //date_updated: new Date()
                    type_token: props.type_token
                    
                }
              },
              create:{
                tokens : {
                    type_token : props.type_token,
                    refresh_token: accessToken.refreshToken,
                    valid: true,
                    expiration: expiration,
                }
              }
            });
    fast parrot 1
    ✅ 1
    s
    • 2
    • 2
1...583584585...637Latest