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

    Casey Chow

    10/08/2021, 5:24 PM
    Is there an existing Github issue or plans to improve modularity of the generated client ? I’m noticing that merely importing Prisma adds 2 seconds per suite to my test runtime, which has tripled our test times in the month since we’ve started using Prisma.
    🤔 1
    m
    • 2
    • 1
  • e

    Evan McDaniel

    10/08/2021, 8:53 PM
    Hi everyone, just getting going and finding that every
    resolve
    i have inside a Nexus
    createType
    (or
    extendType
    ) function is showing basically the same TypeScript error. It’s not failing the compile, but I’m hoping to figure out how to solve the issue (no one likes red error warnings everywhere). This is the error in my simple Query definition
    Copy code
    Type '(_parent: {}, args: { accountId?: number; }, context: Context) => PrismaPromise<Application[]>' is not assignable to type 'FieldResolver<"Query", "applicationsByAccountId">'
    And here’s the definition:
  • e

    Evan McDaniel

    10/08/2021, 8:53 PM
    Copy code
    definition(t) {
    		t.nonNull.list.nonNull.field("applicationsByAccountId", {
    			type: "Application",
    			args: {
    				accountId: intArg()
    			},
    			resolve: (_parent, args, context: Context) => {
    				return context.prisma.account
    					.findUnique({
    						where: { id: args.accountId }
    					})
    					.applications();
    			}
    		});
    	}
    r
    • 2
    • 2
  • e

    Evan McDaniel

    10/08/2021, 8:54 PM
    Would anyone know how to solve that? Thanks a million if so.
  • g

    Gabe O'Leary

    10/09/2021, 12:44 AM
    Hey all! I'm trying to order a set of grouped results by the count of the group, but I'm getting a TS error
    Copy code
    const statusResults = await prisma.status.groupBy({
          by: ["url"],
          where: {
            AND: {
              userIdStr: {
                in: followIds,
              },
              createdAt: {
                gte: startDate,
              },
            },
          },
          count: {
            url: true,
          },
          // this orderBy doesn't seem to be working.
          orderBy: {
            count: {
              url: "desc",
            },
          },
          having: {
            url: {
              count: {
                gt: 1,
              },
            },
          },
        });
    Error:
    Copy code
    TSError: ⨯ Unable to compile TypeScript:
    script.ts:88:9 - error TS2322: Type '{ count: { url: string; }; }' is not assignable to type 'Enumerable<StatusOrderByInput> | undefined'.
      Object literal may only specify known properties, and 'count' does not exist in type 'Enumerable<StatusOrderByInput>'.
    I'm attempting to follow the example shown here and can't figure out where I'm going wrong. Thanks!
    ✅ 1
  • g

    Gabe O'Leary

    10/09/2021, 12:45 AM
    P.S. I see
    _count
    used in some places and
    count
    used in other places. What's the difference? should I be using one over the other?
    r
    • 2
    • 6
  • a

    Alex Cavazos

    10/09/2021, 1:37 AM
    People using Next.js + Prisma.js + Postgres. Are you connecting to the database directly or using pgBouncer?
  • m

    Martin Benjamin

    10/09/2021, 8:51 AM
    Yo guys! There is no way to generate slug from another fields like title? I use prisma with Postgres and I wonder what's the best way to create slug.
    r
    • 2
    • 1
  • r

    Ricky Hopkins

    10/09/2021, 9:51 AM
    Has anyone seen an issue with prisma client when using webpack to build? I am getting this error:
    Can't resolve '_http_common' in 'C:\Users\ricky\projects\spectr\server\node_modules\@prisma\client\runtime'
    I can get around this by setting
    externals: ["_http_common"],
    in my webpack.config, but when I go to run my build with
    node build/index.js
    I get
    ReferenceError: _http_common is not defined
    Anyone seen anything like this. Google is not too helpful
    r
    • 2
    • 2
  • u

    user

    10/09/2021, 10:16 AM
    Prisma Korea Meetup: Jed Watson - Next-gen CMS and GraphQL API with KeystoneJS and Prisma

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

    Jed Watson (@JedWatson) is the co-founder of @thethinkmill and creator of @KeystoneJS. He also organizes @ReactConfAU and co-hosts @ReactSydney. ✨ Join our Prisma Meetup group here: Join our Prisma Meetup group here: https://www.meetup.com/prisma-meetup-korea/ Next: 👉 Check Previous video: Using Nestjs and Prisma for production -

    https://youtu.be/S6a1nganMbg▾

  • j

    Josh Fowler

    10/09/2021, 1:04 PM
    Hello everyone, has anyone had issues this morning with 502 bad gateways with prisma.sh endpoints this morning? Started randomly happening this morning
  • q

    Qaiser Abbas

    10/09/2021, 1:06 PM
    Hello Everyone. I new to Prisma and Next.js I want to implement a Many to Many relationship Like Posts and Tags I just need to know how to select multiple tags and add them to Post while creating the new post. Warm Regards
    d
    r
    • 3
    • 3
  • b

    bashalir

    10/09/2021, 3:51 PM
    Hi i need to use Scalar list filters but i can't use them with Typescript, i have the last version of prisma
    r
    • 2
    • 1
  • t

    Tyler Clendenin

    10/09/2021, 6:52 PM
    is there a way to only connect a relation if the lookup succeeds? relevant question, if two prisma upserts are happening inside a transaction is there any way to ensure that two of them that have the same connectOrCreate don't both try to run a create (they are both runnign asyncrounously and rounded up with a promise.all)?
    r
    • 2
    • 12
  • t

    Tyler Clendenin

    10/09/2021, 8:07 PM
    Is there any helper method or shortcut to deal with the
    Enumerable
    typed properties so I can always deal with them as arrays? Same question with
    XOR
    is there any helper methods to assist in working with it. This relates to the above question because I am piping my upsert records into another stream processor to attempt to upsert any related records prior to running the upsert on the main records.
    r
    • 2
    • 2
  • j

    Josh Fowler

    10/09/2021, 10:49 PM
    Does anyone know the best way to contact prisma1 cloud support? I’ve tried emailing but haven’t got anything
  • s

    Seren_Modz 21

    10/10/2021, 4:43 AM
    hello everyone. i was wondering if there is any better way to get an index without having to fetch the whole table, i am currently doing this:
    Copy code
    const leveling = await prisma.leveling.findMany({ orderBy: { totalXp: "desc" } })
    const index = leveling.findIndex((l) => l.userId === user.id)
    the problem with it, is that as the table scales, finding the index is going to become very slow as its fetching the whole table.
    r
    • 2
    • 2
  • u

    user

    10/10/2021, 10:00 AM
    Prisma Korea Meetup: Han Sangjin - Using Nestjs and Prisma for production

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

    👉 프로덕션 레벨에서 nestjs와 prisma 발표자 : 한상진. Wonderwall 백엔드 개발자 ---- Han Sangjin (https://www.linkedin.com/in/y0on2q/) is the Backend Engineer at 원더월 Wonderwall ✨ Join our Prisma Meetup group here: Join our Prisma Meetup group here: https://www.meetup.com/prisma-meetup-korea/ Next: 👉 Check Next video: Next-gen CMS and GraphQL API with KeystoneJS and Prisma -

    https://youtu.be/C5tScx5bWVg▾

    👉 Check Previous video: Migrate your database & switch to Prisma with Prisma introspect -

    https://youtu.be/C5ouGnXF_zc▾

    👍 1
  • j

    Josh Fowler

    10/10/2021, 9:03 PM
    Anyone from prisma1 server cloud pay plan support here? Having issues with the service and can’t get any help from the support email….
  • s

    Sam

    10/10/2021, 9:06 PM
    Does anyone know if it is possible to re-create this query inside of Prisma 3. I didn't think it was possible in Prisma 2.
    Copy code
    SELECT inviterId, count(*) as count FROM invites where serverId = ${member.guild.id} AND valid = 1 GROUP BY inviterId ORDER BY count DESC LIMIT 10
    r
    • 2
    • 1
  • g

    George Lewis

    10/11/2021, 12:00 AM
    Copy code
    const users = await ctx.prisma.user.findMany({
          where: {
            profile: {
              firstName: {
                contains: args.where.firstName
              },
              DOB: {
                
              }
            }
          }})
    Hi All, need your help .. I am trying to build a query that returns a list of users that have a birthday today .. there is a filed in the user model that has the DOB stored .. Is there anyway to do so?
    r
    t
    m
    • 4
    • 11
  • t

    Tyler Clendenin

    10/11/2021, 12:22 AM
    when creating a record with prisma and attempting to also create some relations, what is the difference between using
    createMany
    and
    create
    with an array of objects?
    r
    • 2
    • 3
  • s

    Seungsu Kim

    10/11/2021, 3:23 AM
    Is it possible to analyze queries executed by prisma client with datadog? I’m running a MySQL database on AWS RDS and collecting queries with a Datadog agent configured by the following guide https://docs.datadoghq.com/database_monitoring/setup_mysql/rds/?tab=mysql57#install-the-agent However, every query samples executed by database user used by prisma client is
    SELECT ?
    . Is it impossible to analyze prisma client executed queries by datadog or any other services?
    👍 1
    r
    a
    c
    • 4
    • 3
  • k

    Kelechi Oliver

    10/11/2021, 6:54 AM
    Hi everyone, I've got a User schema as shown below,
    Copy code
    model User {
      id              String            @id @default(uuid())
      firstName       String
      lastName        String
      email           String            @unique
      /// @TypeGraphQL.omit(output: true)
      password        String
      accountType     accountType       @default(STUDENT)
      role            role              @default(LEARNER)
      profileStudent  ProfileStudent?
      profileTeacher  ProfileTeacher?
      ....
    }
    I'm using
    Typegraphql Prisma
    to generate types shown below,
    Copy code
    @TypeGraphQL.ObjectType({
      isAbstract: true
    })
    export class User {
      @TypeGraphQL.Field(_type => String, {
        nullable: false
      })
      id!: string;
    
      @TypeGraphQL.Field(_type => String, {
        nullable: false
      })
      firstName!: string;
    
      @TypeGraphQL.Field(_type => String, {
        nullable: false
      })
      lastName!: string;
    
      @TypeGraphQL.Field(_type => String, {
        nullable: false
      })
      email!: string;
    
      password?: string;
    
      @TypeGraphQL.Field(_type => accountType, {
        nullable: false
      })
      accountType!: "STUDENT" | "TEACHER";
    
      @TypeGraphQL.Field(_type => role, {
        nullable: false
      })
      role!: "ADMIN" | "INSTRUCTOR" | "LEARNER";
    
      profileStudent?: ProfileStudent | null;
    
      profileTeacher?: ProfileTeacher | null;
    My problem is, the corresponding graphql schema generated does not include
    profileStudent
    &
    profileTeacher
    Copy code
    type User {
      UserCohort: [UserCohort!]
      UserSubject: [UserSubject!]
      _count: UserCount
      accountType: accountType!
      createdAt: DateTime!
      email: String!
      firstName: String!
      id: String!
      lastName: String!
      messagingId: String
      role: role!
      status: accountStatus!
      token: String
      updatedAt: DateTime!
    }
    does anyone have an idea what might be the issue?
    r
    • 2
    • 3
  • z

    Zakaria

    10/11/2021, 9:08 AM
    NestJs/GraphQL question: I bought a template that is based on a Nestjs graphql API (look here: https://github.com/zakariamofaddel/NestJsGraphQL). I never worked with NestJs and I would like to migrate this whole thing to a Nodejs, Apollo-server and Prisma. Is there a quick way to generate a schema.prisma file from a schema.graphql file or from typescript classes?
    r
    • 2
    • 3
  • r

    Reuben Porter

    10/11/2021, 11:18 AM
    Question regarding pagination in Prisma with postgres: Is there a way I can include a total count of records as well as using
    skip
    and
    limit
    that doesn't include a separate count query in a transaction?
    r
    • 2
    • 3
  • d

    dodgers

    10/11/2021, 11:24 AM
    Hello, when "MongoDB Embedded Document Support" is planned to release?
    r
    • 2
    • 4
  • j

    Jens Dunzweiler

    10/11/2021, 3:38 PM
    Hello! Right now I'm looking at Prisma. I am currently working with TypeORM. One thing that I can't do with TypeORM, or don't know how: Each table has at least four identical columns. "changed_at", "changed_by", "deleted_at" and "deleted_by" The first: how can I inherit these fields in Prisma? The second: how can I write a hook in Prisma that gets the user and sets these fields accordingly? The third: how can I tell Prisma that the database entries are never really deleted, but only "deleted_by" and "deleted_at" should be set? "deleted_by" and "changed_by" is always in a relationship to a user. I would like to define that only once.
  • a

    Augustus Chang

    10/11/2021, 4:12 PM
    Is it recommended to add persistent caching (ex: query cache) using the https://www.prisma.io/docs/concepts/components/prisma-client/middleware feature? Just want to make sure that if data is in the cache, as a developer I can return the results from the cache (ex: memcached) and tell prisma to not fetch from the database.
  • i

    Ibad Shaikh

    10/11/2021, 8:37 PM
    Hi Prisma family👋 I want to know if I can replace text of any field (type: String) using updateMany( ) Problem : I have a column message in comments table. I want to replace yoy string by oyo in message field. Is there any way to do so? Thanking in advance:)
    r
    • 2
    • 1
1...492493494...637Latest