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

    perp

    12/02/2021, 11:57 AM
    Is there a way to generate typescript repository layers from prisma schema?
    v
    • 2
    • 1
  • e

    Emre Deger

    12/02/2021, 2:12 PM
    I am having a BigInt problem in test cases. Prisma data (
    id: 1n
    ) and JSON response (
    id: 1
    ) data do not match. Anyone have an idea?
  • o

    Octavio Augusto Barbosa

    12/02/2021, 2:26 PM
    Hello all, help me please. error in test pipeline in gitlab-ci
    Copy code
    > pix-orm-prisma@0.0.6 postinstall /builds/fintech/pix/api/node_modules/pix-orm-prisma
    > npx prisma generate
    internal/modules/cjs/loader.js:883
      throw err;
      ^
    Error: Cannot find module '/root/.npm/_npx/72/lib/node_modules/prisma/scripts/preinstall-entry.js'
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
        at Function.Module._load (internal/modules/cjs/loader.js:725:27)
        at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
        at internal/main/run_main_module.js:17:47 {
      code: 'MODULE_NOT_FOUND',
      requireStack: []
    }
  • k

    Kindly

    12/02/2021, 4:10 PM
    After the last vscode extension update, Prisma started indenting my schema file using two spaces instead of four. Is there something I can do to get back the old behavior? Using it with Prettier as documented in the plugin
  • m

    manuel

    12/02/2021, 4:35 PM
    Hi everyone! I have a question. I do have a postgres database with the field type
    Date
    and the values are
    1999-12-22
    My schema looks like this. But If I want to insert it prisma complains that it wants a DateTime value and not a string. If i make it a DateTime value prisma adds the time again. I only want to have the type Date in the database without the time.
  • m

    manuel

    12/02/2021, 4:59 PM
    So what I found out, prisma still needs the ISO format meaning DateAndTime. But why do I flag it then with`@db.Date` if it's saved as
    DateTime
    ?
    m
    • 2
    • 9
  • u

    user

    12/02/2021, 5:34 PM
    Data Projections (Feature concept for the Prisma Data Platform)

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

    In this video, you'll see a demo of the early concept our team is working on to use the Prisma Schema to create data projections across data sources almost instantly. Author: Alex Ruheni, Developer Advocate at Prisma
  • r

    rdunk

    12/02/2021, 6:47 PM
    Anyone managed to get
    t.json
    types to play nicely with
    nexus-prisma
    ? Not sure if I need to manually change some declarations after creating the scalar and schema types.
    Copy code
    const jsonScalar = new GraphQLScalarType({ ...JSONObjectResolver, name: 'Json' });
    const json = asNexusMethod(jsonScalar, 'json');
  • r

    rdunk

    12/02/2021, 6:48 PM
    atm I get
    Property 'json' does not exist on type 'InputDefinitionBlock<"FoobarInput">'
  • j

    Jinho Chung

    12/03/2021, 2:21 AM
    I am trying to move from a local version of Postgres to a remote Postgres DB on Azure. I can connect to it and perform instrospection using
    npx prisma db pull
    with the schema appropriately updating. However when I perform a simple query (e.g.
    const data = await prisma.cases.findMany()
    ) I get:
    Copy code
    PrismaClientKnownRequestError: Invalid `prisma.cases.findMany()` invocation
    and:
    Copy code
    code: 'GenericFailure',
    clientVersion: '3.6.0',
    meta: undefined
    The routes that I was using before worked perfectly fine on my local version. The only difference I can think of is that the local version was Postgres 13 while the Azure version is 11. Any ideas of what is going on?
    ✅ 1
    • 1
    • 1
  • a

    Aaron Waller

    12/03/2021, 4:24 AM
    As soon as I switch from my local Postgres DB to a production Postgres DB hosted on DigitalOcean my API stops working and I get the following error:
    Copy code
    "message": "Cannot read property 'create' of undefined",
    My code is working fine on my localhost, how is that possible?
    r
    • 2
    • 1
  • a

    Aaron Waller

    12/03/2021, 5:25 AM
    Searching for an Prisma/GraphQL/Node.js freelancer who can help me with my database. Currently developing a social media network: Any Ideas where I can find one? Or suggestions on places to look?
    j
    • 2
    • 1
  • a

    Aaron Waller

    12/03/2021, 8:00 AM
    Whats the best place to find some help with prisma related stuff? I don’t get answers on StackOverFlow for two weeks now
    j
    • 2
    • 1
  • c

    Chris Bitoy

    12/03/2021, 8:24 AM
    Good morning y’all, any prisma ninja here to help with a migration issue?
    ✔️ 1
    j
    • 2
    • 18
  • a

    Albin Groen

    12/03/2021, 8:40 AM
    Hey, I'm working on this issue and wondering if there's any reference on which types are available for each provider etc?
    n
    • 2
    • 5
  • m

    manuel

    12/03/2021, 9:50 AM
    Hello! I asked yesterday without success.. maybe more luck today. I am migrating a postgresdb to prisma. I have a postgres field called
    startDate
    with type
    DATE
    which I have as a String
    1999-01-22
    in my seeds. What's the correct way to have it in the new postgresdb with prisma to have only the date and not the DateTime. Because if I insert it with
    new Date(startDate)
    I get the date in the database including the time set to 000000....
    d
    • 2
    • 5
  • m

    manuel

    12/03/2021, 9:50 AM
    my startDate in the prisma.schema looks like
    startDate DateTime @db.Date
  • u

    user

    12/03/2021, 10:06 AM
    Prisma Meetup India #1

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

    On December 14, 18:30 IST we are meeting for the first time in the new, refreshed format of the meetup! Prisma Meetup India is an online event aiming to connect, inform and empower the developers from these parts of the world. Join with other local engineers to discuss the latest database and API developments and learn more about Prisma best practices. Prisma replaces traditional ORMs and data access layers with a universal database abstraction used via the Prisma client. Prisma is used to build GraphQL servers, REST APIs & database microservices. Talks of this edition: ◭ "Introduction to Prisma" by Sathyajit Loganathan (@SathyajitL) ◭ "Powering apps with Prisma and Graphene👨‍💻" by Shivansh Srivastava (@Shivansh_2407) Join our group: https://www.meetup.com/meetup-group-lzVmbPjc/
  • s

    Siemen Blok

    12/03/2021, 11:19 AM
    Does anyone know if, and if so how, prisma can work with multiple PostgreSQL schema's? I have a PostgreSQL database and each client has their own schema (all the same). I'm looking for a way I can query the right schema for each client dynamically, and was wondering if Prisma could offer something like that?
    n
    k
    • 3
    • 3
  • y

    yoav weber

    12/03/2021, 12:31 PM
    Hey people, I am working on query optimization for my application using the queries Prisma is logging. Is there any way to see what are the binding variable(Hope I am using the right term here) that the sql query is using? For example, given the following query:
    Copy code
    SELECT * FROM Project WHERE "Project"."sponsor" IN ($1) OFFSET $2
    What would be the
    $1
    and
    $2
    ?
  • u

    user

    12/03/2021, 1:23 PM
    GraphQL Berlin Meetup #24 - Dominik Kress - GraphQL as an API Gateway

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

    ◭ With the trend of the microservice architecture distributed systems are more complex than ever before. But there are more and more tools to control the chaos of architecture of many small services with many small interfaces. One of those innovative helpers is also GraphQL - which can not only be an API but also an API-Gateway for other (GraphQL-)APIs. In this talk, we want to discover how this is possible. ◭ Dominik Kress is author of the german written book "GraphQL – Eine Einführung in APIs mit GraphQL", explaining fundamentals of APIs and GraphQL. Next to his (too) many side-projects and publications around the topics of Interface-Optimization he works as a Technical Product Owner for the Schwarz Groups Cloud Initiative. ◭ Get in touch with Dominik: https://github.com/Rotfuks ◭ Join our GraphQL Berlin Meetup group: https://www.meetup.com/graphql-berlin
  • f

    Frederik

    12/03/2021, 1:39 PM
    https://prisma.slack.com/archives/CBFFY3066/p1638538756034800
  • j

    John Meyers

    12/03/2021, 2:24 PM
    is there a way for Prisma to not return date in this format
    2021-12-03T13:51:22.000Z
    ? but shorter?
    j
    • 2
    • 1
  • d

    Dale Weaver

    12/03/2021, 5:24 PM
    I'm using Postgres and had a question about using UUID's for primary key. Is there any advantage of using Prisma's UUID function for generating default UUID verses Postgres's gen_random_uuid? If I'm creating a parent and child record at the same time, will using Prisma's UUID function save me a round trip to Postgres and insert both parent and child at the same time (since Prisma already knows UUID)? Or does Prisma first insert parent record and then gets UUID returned from insert to use for the foreign key on related record insert (2 calls to Postgres)?
  • k

    Kevin

    12/04/2021, 1:24 AM
    What's the best way to add a custom field to a model class generated by
    typegraphql-prisma
    ? There are instructions here: https://prisma.typegraphql.com/docs/advanced/adding-fields but if any new custom field gets added to a generated model class, wouldn't it just be overwritten the next time I run
    prisma generate
    ? The new field is something I added to the generate typegraphql class and does not exist in the prisma.schema file.
  • d

    Daniel De La Luz

    12/04/2021, 3:14 AM
    Hello how to request a new feuture ?
    m
    n
    • 3
    • 3
  • c

    Carlos

    12/04/2021, 4:20 AM
    Hello again, Anybody has any idea of how to work with “user fields” in Prisma. In my application, customers (Tenants) should be able to create their own columns in the table without affecting the Prisma Schema. Base system columns cannot be modified, however, customer can add new columns example: Ticket number, reference or anything they want which is only used in reports. Is it possible to mark some columns as “*Ignore*” or “*Not Manage*” in Prisma so that they are skip when performing migrations, db pull and prevent prisma from throwing errors?
    n
    • 2
    • 2
  • u

    user

    12/04/2021, 11:04 AM
    GraphQL Berlin Meetup #24 - Bob van Luijt - Building GraphQL APIs for a vector search engine

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

    ◭ Machine learning has become an omnipresent tool that powers many applications, so when Weaviate started out building a database that has a specific focus on searching through machine learning vectors, they needed an interface that has a great UX, is simple to use, and could represent the data in a way they needed. During this talk, Bob will present a case study of the GraphQL interface in the Weaviate vector searching engine. What problem did they aim to solve, Why did they pick GraphQL and how is it implemented? ◭ Links: 1. https://www.semi.technology/developers/weaviate/current/ 2. https://github.com/semi-technologies/weaviate ◭ Bob is CEO and co-founder of SeMI Technologies, the business created around the open-source vector search engine Weaviate. Besides SeMI and Weaviate. Bob is a frequent speaker on the topics of open source, digital technology, software business, and creativity. He has spoken at around 100 events on the aforementioned topics in Europe, the US, and Russia. ◭ Get in touch with Bob: https://twitter.com/bobvanluijt ◭ Join our GraphQL Berlin Meetup group: https://www.meetup.com/graphql-berlin
    b
    • 1
    • 1
  • g

    George Lewis

    12/04/2021, 6:05 PM
    Hi All, I am facing a problem and I spent more than 5 hours trying to solve it with no luck. I have a model organizationMembership as follow
    Copy code
    model OrganizationMembership {
      id          String                   @id @default(cuid())
      permissions OrganizationPermission[]
    
      dailyVerseNotification Boolean? @default(false)
    
      organization   Organization @relation(fields: [organizationId], references: [id])
      organizationId String
      profile        Profile?     @relation(fields: [profileId], references: [id])
      profileId      String?
      user           User?        @relation(fields: [userId], references: [id])
      userId         String?
    
      startDate DateTime @default(now())
      updatedAt DateTime @updatedAt
    
      meetingRoomReservationModerated MeetingRoomReservation[]
    
      @@unique([userId, organizationId])
      // @@index([profileId])
      // @@index([userId])
      // @@index([organizationId])
      // @@unique([profileId, organizationId])
    }
    and a resolver to query all the organizationMemberships as follow
    Copy code
    async organizationMemberships(
        _parent: any,
        args: OrganizationMembershipsArgs,
        ctx: ContextInterface
      ): Promise<OrganizationMembership[]> {
        const organizationMemberships = ctx.prisma.organizationMembership.findMany({
          where: {
            id: args.where?.id,
            userId: args.where?.user?.id,
            organizationId: args.where?.organizationId?.length
              ? { in: args.where.organizationId }
              : undefined,
            user: {
              profile: {
                name_search_key: {
                  contains: args.where?.name_search_key,
                  mode: 'insensitive'
                }
              }
            }
          },
          skip: args.skip,
          take: args.first
        })
    The problem is that when i run the query (Searching by OrganizationId) I only get the records that have a user entity not the rest (with null user). can anyone help?
  • d

    Daniel

    12/05/2021, 3:33 AM
    hi all! hopefully I'm doing something wrong here, but is there a reason why, when using interactive transactions, these items are not rolled back? sample code:
    Copy code
    // prisma schema file
    model Item {
      id   String @id @default(uuid())
      name String
    }
    
    // code:
    try {
        await prisma.$transaction(async () => {
          await prisma.item.create({
            data: {
              name: 'item 1',
            },
          })
    
          await prisma.item.create({
            data: {
              name: 'item 2',
            },
          })
    
          throw new Error('Oh no something went wrong.')
        })
      } catch (err) {
        console.log('Rolled back?')
      }
1...515516517...637Latest