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

    joao.santos

    07/10/2021, 6:46 AM
    Hi guys can we create dyamic tables with prisma? Im building a chat, I would like to have tables for each client ID, is this the best way, or whta should I do to scale 4 tables of a chat? Thx in advanced
    r
    m
    • 3
    • 6
  • k

    khareta

    07/10/2021, 9:39 AM
    Getting this error in a production env:
    Copy code
    `ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Server(ServerError { code: 1461, message: "Can\\'t create more than max_prepared_stmt_count statements (current value: 16382)", state: "42000" })) })`,
    I read here https://github.com/prisma/prisma/issues/6872 that it was fixed in v2.25(although it isn't mentioned in the release notes). But unfortunately, I have to stay at v2.19 for a month or two until next major release(breaking changes). So, what values do you recommend for that parameter? max_prepared_stmt_count currently the default is 16k something.
    j
    • 2
    • 1
  • b

    BlackFeather97

    07/10/2021, 10:50 AM
    hi guys, i'm having an issue querying the database. I've created a stack overflow question here, i'd appreciate if someone could help https://stackoverflow.com/questions/68326989/how-do-i-use-and-operator-with-multiple-query-parameters-in-nested-relation-wh
  • b

    Ba Thien Tran

    07/10/2021, 10:51 AM
    Hi everyone, this is not working for me – it says that this is of invalid format (it is supposed to be a datetime value instead of a string, but the doc shows this as an example).
    r
    • 2
    • 3
  • m

    Marco Moi

    07/10/2021, 10:56 AM
    hi guys, is possible to use prisma 2.26 with nexus-plugin-prisma?
    a
    • 2
    • 1
  • s

    Slackbot

    07/10/2021, 3:26 PM
    This message was deleted.
    r
    • 2
    • 1
  • r

    Ridhwaan Shakeel

    07/11/2021, 2:00 AM
    does prisma fetch
    null
    &
    undefined
    in orderBy and sort them at the bottom or does it omit fetching them?
    r
    • 2
    • 1
  • g

    Gelo

    07/11/2021, 3:02 AM
    Is self reference supported?
    r
    • 2
    • 2
  • j

    jasci

    07/11/2021, 10:29 AM
    Hello everybody. Wanted to clear some things up regarding new 
    onDelete
     and 
    onUpdate
     behaviour. We’ve got 3 types of relations: 1-1, 1-n, n-n with 3 possible ways to set up. Wanted to clarify how to properly add cascading deletes/updates to all of them. Please correct me if I’m wrong. 1. n-n relations If I delete Profile, all User records that are related are deleted too.
    Copy code
    model User {
      id    String @id
      profiles Profile[] @relation(onDelete: Cascade, onUpdate: Cascade)
    }
    
    model Profile {
      id    String @id
      users User[]
    }
    If I delete User, all Profile records that are related are deleted too.
    Copy code
    model User {
      id    String @id
      profiles Profile[]
    }
    
    model Profile {
      id    String @id
      users User[] @relation(onDelete: Cascade, onUpdate: Cascade)
    }
    If I delete User, all Profile records that are related are deleted too. And the other way around.
    Copy code
    model User {
      id    String @id
      profiles Profile[] @relation(onDelete: Cascade, onUpdate: Cascade)
    }
    
    model Profile {
      id    String @id
      users User[] @relation(onDelete: Cascade, onUpdate: Cascade)
    }
    2. 1-n relations If I delete a User, all Profile records that are related are deleted too.
    Copy code
    model User {
      id    String @id
      profiles Profile[]
    }
    
    model Profile {
      id     String @id
      userId string
      user   User   @relation(fields: [userId], onDelete: Cascade, onUpdate: Cascade)
    }
    If I delete a Profile, the User record that is related is deleted too.
    Copy code
    model User {
      id    String @id
      profiles Profile[] @relation(onDelete: Cascade, onUpdate: Cascade)
    }
    
    model Profile {
      id     String @id
      userId string
      user   User
    }
    Combination of the previous 2 actions.
    Copy code
    model User {
      id    String @id
      profiles Profile[] @relation(onDelete: Cascade, onUpdate: Cascade)
    }
    
    model Profile {
      id     String @id
    	userId string
      user   User   @relation(fields: [userId], onDelete: Cascade, onUpdate: Cascade)
    }
    1. 1-1 relations If I delete a User, the Profile record that is related is deleted too.
    Copy code
    model User {
      id    String @id
      profile Profile?
    }
    
    model Profile {
      id     String @id
      userId string
      user   User   @relation(fields: [userId], onDelete: Cascade, onUpdate: Cascade)
    }
    If I delete a Profile, the User record that is related is deleted too.
    Copy code
    model User {
      id    String @id
      profile Profile? @relation(onDelete: Cascade, onUpdate: Cascade)
    }
    
    model Profile {
      id     String @id
      userId string
      user   User
    }
    Combination of the previous 2 actions.
    Copy code
    model User {
      id    String @id
      profile Profile? @relation(onDelete: Cascade, onUpdate: Cascade)
    }
    
    model Profile {
      id     String @id
    	userId string
      user   User   @relation(fields: [userId], onDelete: Cascade, onUpdate: Cascade)
    }
    Thank you.
    r
    • 2
    • 5
  • d

    Dog

    07/11/2021, 4:18 PM
    Hi guys. Has anyone worked with saving analytics data with prisma?
    t
    • 2
    • 1
  • d

    Dog

    07/11/2021, 4:18 PM
    I am trying to investigate how to store analytics the best way possible and I'm kind of curious of how it works
  • t

    Tarik Brat

    07/12/2021, 12:34 PM
    Hi guys, quick question ? I'm working on sorting endpoint and I'm using orderBy property, now I'm wondering how can I make it dynamic with typescript? To be more specific I'm wondering how can I make order field based on url query params?
    r
    • 2
    • 5
  • t

    Tarik Brat

    07/12/2021, 12:35 PM
    I'm unable to match types no matter what
  • l

    Luis Kuper

    07/12/2021, 1:51 PM
    Hi there, Is it possible to query the index of an entry within a specific order? e.g. If I order a list by its creationDate, and wanna know at which index the element with id "12345" is within this list.
    r
    • 2
    • 2
  • j

    justinhandley

    07/12/2021, 2:52 PM
    Does anyone know if when relationships are created Prisma automatically indexes foreign keys?
    j
    • 2
    • 3
  • m

    Mischa

    07/12/2021, 3:33 PM
    I want to create a lambda function that runs migrations. I'm not using Serverless. How do I run
    migrate deploy
    programmatically? Looks like maybe I want to use https://github.com/prisma/prisma/blob/master/src/packages/migrate/src/Migrate.ts ?
    j
    • 2
    • 7
  • m

    manuel

    07/12/2021, 3:34 PM
    the seed script get's hung up with the
    Result:
    but in the db everything shows up... ?!?
    j
    • 2
    • 7
  • r

    RoMay

    07/12/2021, 4:24 PM
    Hi there, a quick question about
    @updatedAt
    - it seems the timestamp gets updated on every update of the record, even when the new dataset is exactly the same as the origin one. Is there any way to exclude empty updates on Prisma/ORM level, so the updatedAt considers only real delta in the update scenario? I guess, this would give us less redundancy and additional a performance bonus.
    r
    • 2
    • 6
  • a

    Adam

    07/12/2021, 4:52 PM
    If I give
    prisma
    a postgres connection string with a schema that doesn't exist, it should create it correct?
    d
    j
    • 3
    • 8
  • g

    Gelo

    07/12/2021, 5:16 PM
    {where{name undefined}} does prisma delete undefined properties inside where clause??
    r
    • 2
    • 3
  • w

    Will

    07/12/2021, 6:10 PM
    is it possible to get a hash/object back from prisma instead of rows? I want to pull back a result set, but rather than looping through the results, I want to pull specific rows based on a unique column value
    b
    • 2
    • 1
  • w

    Will

    07/12/2021, 6:13 PM
    or is the correct convention to query multiple times for each row? I will be pulling back each row of the small table (10-15 rows) into my app each time
  • e

    Ethan Zoller

    07/12/2021, 8:04 PM
    How can I do a read with prisma based off time? For example, I want to get all users created in the last 7 days. Or, I want to get all users created between June 11th to June 16th.
    w
    • 2
    • 7
  • m

    Marco Moi

    07/12/2021, 8:54 PM
    Hi guys, is nexus-plugin-shield supported for use it with nexus & prisma? I want to use graphql Shield with nexus
    r
    s
    • 3
    • 3
  • w

    Will

    07/12/2021, 9:06 PM
    For some reason, when I upload a nextjs app (using Prisma) to OpenShift (kubernetes) , the only way I can get prisma to work is if I copy another copy of
    .env
    from
    ./prisma/.env
    to
    ./.env
    - any idea why this is?
    r
    • 2
    • 2
  • s

    Seungsu Kim

    07/13/2021, 1:21 AM
    Is there a way to attach suffix to type names generated by prisma client? For example, if I have a
    model User
    in
    schema.prisma
    , I want the name of generated type to be
    UserModel
    r
    • 2
    • 1
  • g

    Gelo

    07/13/2021, 7:00 AM
    Does anyone encounter this issue when deploying changes in schema
  • g

    Gelo

    07/13/2021, 7:00 AM
    r
    • 2
    • 5
  • m

    Mikastark

    07/13/2021, 8:38 AM
    Hello there 🙂 I was thinking about authentication and following this post from Apollo website (https://www.apollographql.com/docs/apollo-server/security/authentication/#authorization-in-resolvers) you should get user infos from token directly when the server receive a request (event if the resolver is not guarded) and following @nikolasburk exemple (https://github.com/prisma/prisma-examples/blob/latest/typescript/graphql-auth/src/permissions/index.ts) you should do it only when you need user infos but it leads to extract token data multiple times. So the question is : Which one is the better ? How do you handle this in your projects ? (For now I use the Niko approach but I'm not sure it's the right way)
    r
    • 2
    • 6
  • i

    Ian

    07/13/2021, 8:52 AM
    Copy code
    model User {
      id String @default(cuid())
    
      @@id([id])
    }
    
    model Group {
      id String @default(cuid())
    
      @@id([id])
    }
    
    model Member {
      group   Group  @relation(fields: [groupId], references: [id])
      groupId String
      user    User   @relation(fields: [id], references: [id])
      id      String
    
      @@id([groupId, id])
    }
    When creating user only it works fine, no problem with the default generation value of cuid() But When creating group only it doesn't work it says Null constraint error for id both from API and PRISMA studio Why does my default cuid doesnt work? Current workaround use cuid npm package
    r
    • 2
    • 2
1...456457458...637Latest