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

    Kasir Barati

    04/21/2022, 11:18 AM
    A question, I specifies a
    username
    field
    unique
    , and
    id
    is
    serial
    . OK. Now when I insert
    { username: 'Ali' }
    , It will be inserted and in the response I get
    {id: 1, username: 'Ali'}
    and I try to insert it again, database will yells and says that username is duplicate. So I try something else -
    { username: 'Mohammad' }
    - and this time it will be inserted but I realized something weird and strange, The response will be
    {id: 3, username: 'Mohammad' }
    . Why? Why
    id
    jumps one number (The number 2 is missed, Number 2 was the duplicate
    username
    )? Any though? • IMO this is not a good thing.
    n
    • 2
    • 2
  • a

    Albin Groen

    04/21/2022, 12:21 PM
    Is anyone here a prisma client expert? I have a fairly complex use case that I need help with
    k
    v
    • 3
    • 4
  • e

    engineer1234

    04/21/2022, 1:49 PM
    https://prisma.slack.com/archives/CA491RJH0/p1650504833635729 FYI: the answer is no, you cannot
  • j

    justinhandley

    04/21/2022, 2:25 PM
    Looking for best practice ideas - with resolvers
    Copy code
    @ResolveField(() => [JournalTag], { nullable: true })
    tags(@Parent() user: User) {
      return user?.tags
    }
    or
    Copy code
    @ResolveField(() => [JournalTag], { nullable: true })
    tags(@Parent() user: User) {
      return this.data.user.findUnique({where: {id: user.id}}).tags()
    }
    The first one requires I include the data in the query, the second one doesn’t - what do you guys do?
    n
    • 2
    • 1
  • k

    Kasir Barati

    04/21/2022, 5:01 PM
    Any progress on this: https://www.notion.so/Prisma-Roadmap-50766227b779464ab98899accb98295f?p=525cf298497b4872a03dc7149f09f22d
    👍 1
    n
    • 2
    • 2
  • j

    Juan Gonzalez

    04/21/2022, 5:09 PM
    Is there a way to define prisma schema types similar to how you would do the following in typescript
    Copy code
    type itemType = boolean | string | number;
    a
    • 2
    • 2
  • t

    Trenton K

    04/21/2022, 8:41 PM
    Any suggestions for how to resolve an error like this?
    Context: Timed out trying to acquire a postgres advisory lock (SELECT pg_advisory_lock(72707369)). Elapsed: 10000ms. See <https://pris.ly/d/migrate-advisory-locking> for details.
    n
    j
    • 3
    • 5
  • l

    Luis Kuper

    04/22/2022, 7:10 AM
    Hey 👋 Has there anything being planned yet to support CONCAT on fields? e.g. for searching:
    CONCAT(firstName, ' ', lastName) AS fullName
    n
    • 2
    • 1
  • o

    Oleg Rudak

    04/22/2022, 8:42 AM
    Hello everyone Can I use
    dataProxy
    previewFeature and
    $transaction
    API Confused because of Prisma 3.8 update:
    Copy code
    dataProxy and interactiveTransactions are now mutually exclusive
    Before Prisma 3.8.0, Prisma queries would fail whenever the Data Proxy and interactive transactions Preview features were used together
    y
    n
    • 3
    • 2
  • t

    Tim Dehof

    04/22/2022, 11:32 AM
    Hello everyone, I’m using Prisma for an e-commerce site for my capstone project for my coding Bootcamp. I really enjoy how it streamlines the database for my team.
    👍 3
    💚 1
    n
    • 2
    • 1
  • t

    Teodoro Villanueva

    04/22/2022, 1:37 PM
    Hey!
  • t

    Teodoro Villanueva

    04/22/2022, 1:37 PM
    Quick question, prisma mongodb currently does not support $pull?
    n
    • 2
    • 1
  • t

    Teodoro Villanueva

    04/22/2022, 1:37 PM
    its weird since it supports $push
    n
    • 2
    • 4
  • e

    Eu Jin Kim

    04/22/2022, 8:39 PM
    Hello everyone! quick question.. I am working on a project using serverless functions. I’ve been reading about the potential connection pooling issue. The mitigation I read was about using pgBouncer (for Postgres). If using AWS Aurora serverless, does this issue go away/be mitigated OR there would be the same issue with connection pooling? (we don’t want the db exposed to public internet)
    n
    • 2
    • 4
  • h

    Hugo Vallejo

    04/22/2022, 8:56 PM
    Dataproxy is not working on my local project but it is on vercel
    a
    • 2
    • 1
  • h

    Hugo Vallejo

    04/22/2022, 8:57 PM
    So weird
  • h

    Hugo Vallejo

    04/22/2022, 8:59 PM
    just says this
  • l

    louis-sanna-eki

    04/22/2022, 9:20 PM
    Hello all, I would like to build a crud builder, but I don't know how to type a model.
    Copy code
    interface CrudServices<T> {
      getDocument: (id: number) => Promise<T>;
    }
    
    function buildCrudServices<T>(model): CrudServices<T> {
      const getDocument = (id: number): Promise<T> =>
        model.findUnique({ where: { id } });
    
      return { getDocument };
    }
    How do I type model? Each of my model have costum type in the prisma client.
    n
    • 2
    • 2
  • p

    Pranav Sathyanarayanan

    04/23/2022, 1:32 AM
    Hi Everyone, I am trying to understand the characteristics of connection pooling for Prisma running on Cloud Run. I understand that the default connection size is
    2n+1
    and our services operate with 4 vCPU . We currently have 20 instances of our service initialized and running; yet the steady state "# active connections" for our production database shows
    320
    active connections. Is there any information on how to debug why this may be occuring? I can't think of any other reason we would have so many connections open.
    n
    • 2
    • 2
  • i

    Ian Ray

    04/23/2022, 9:47 AM
    If I wanted to order-by-predecessor-successor relationship, is there a conventional, non-raw-query method for doing this with Prisma@3+? For instance, I've got a model:
    Copy code
    model OrderedNode {
      id                      String       @id @default(uuid()) @db.Uuid
      predecessor_id          String?      @unique @db.Uuid
      predecessor             OrderedNode? @relation("predecessor_successor", fields: [predecessor_id], references: [id])
      successor               OrderedNode? @relation("predecessor_successor")
    }
    and I want the element with
    predecessor_id = null
    to show up first, and
    successor = null
    to show up last.
    n
    • 2
    • 2
  • f

    Fiqri Syah Redha

    04/23/2022, 4:32 PM
    Hi, I'm using Nx with NestJS and Prisma for my final university project. I want to create two back-end applications, one with monolithic architecture and another one with microservices. I kept those application in monorepo using Nx. What I want to accomplished is how to reusing most of the app logic (like services, etc) between those two applications but with different Prisma schema (ex. one for product, one for user, etc) and still can use models from Prisma client between those two applications. Anyone have a suggestion how can I workaround this struggle? Thanks and sorry for my bad language.
    n
    • 2
    • 1
  • s

    sriram hegde

    04/23/2022, 9:44 PM
    How do you manage different dbs for different environments like test development and production on prisma
    n
    • 2
    • 1
  • p

    prisma chobo

    04/23/2022, 10:19 PM
    Hello teams! Have a chobo question here..
    Copy code
    model Role {
      id                  String            @id @default(auto()) @map("_id") @db.ObjectId
      name                String  
      // ****************************************************
      application         Application       @relation(fields: [applicationId], references: [id])
      applicationId       String    
      user                User[]            @relation(fields: [userIds], references: [id])
      userIds             String[]          @db.ObjectId
    
      @@index([applicationId])
      @@index([userIds])
      @@index([applicationId, userIds])
    }
    This is a Role schema for mongodb. when I index like above, does it mean Im indexing applicationId only, and userIds only, and both combined applicationId and userids togerther?? So my purposes are 1. i want to get all users in the application (that is why i index @@index([applicationId]) 2. I want to get all applications that a user belong to (@@index([userIds]) 3. I want to check if a user exists in application (@@index[userids, applicationId]) Is it too much indices? should i get rid of @@index([appicationId, userIds])?? Thank you in advance!!
    n
    • 2
    • 1
  • j

    Joe

    04/23/2022, 11:30 PM
    Polymorphic Relations: https://github.com/prisma/prisma/issues/1644 Interfaces: https://github.com/prisma/prisma/issues/2506 Is either supported, or are there any efforts to make it happen? Anything I can assist in if it doesn’t exist?
    n
    • 2
    • 1
  • s

    Sami Ullah

    04/24/2022, 12:07 AM
    Hello everyone, I'm new to nestJS/Prisma. Can anyone please explain how to split modals in Prisma rather than creating all in a single file?
    n
    • 2
    • 2
  • ø

    Ørjan

    04/24/2022, 12:13 AM
    Hi @Sami Ullah. Unfortunately, this feature is not available yet. It is in the roadmap as a candidate, so hopefully they will get to it soon
    v
    • 2
    • 2
  • d

    Domenico Rutigliano

    04/24/2022, 1:08 AM
    hey guys anyone knows a slack channel where to discuss ReactJS ?
    a
    n
    • 3
    • 2
  • n

    nilsso

    04/24/2022, 4:22 AM
    Hello everyone 👋 I'm a user through the community Python client, but have been trying to reproduce some problems in the JS client. Has anyone had issues creating on relational data using
    ”connect”
    ? Currently I’m getting that the create fails to return anything
    n
    • 2
    • 1
  • r

    Redeemer Pace

    04/24/2022, 3:29 PM
    Hi, Hope you'll doing well I'm using cloudflare workers, and running to a strange issue, as it is implemented as the docs mentions below https://www.prisma.io/docs/guides/deployment/deployment-guides/deploying-to-cloudflare-workers The error mentioned is "Error: PrismaClient is unable to be run in the browser. In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues" - We're using dataproxy client using the command "PRISMA_CLIENT_ENGINE_TYPE=dataproxy npx prisma generate" - Rollup config which adds the part of alias "'@prisma/client$': require.resolve('@prisma/client')," - Prisma schema & Prisma Data Platform - Env key for both shadow db & db url is there - Locked ts loader at 8.3.0 as suggested Any recommendations what else can it be the issue?
    ✅ 1
    n
    • 2
    • 3
  • b

    Burr Sutter

    04/24/2022, 4:34 PM
    How to not NOT NULL with Postgres: I am sure this question has been asked before but I do not see an answer here in Slack nor with this doc https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference
    n
    • 2
    • 6
1...566567568...637Latest