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

    Gautam Paranjape

    07/07/2021, 10:12 PM
    What is the font of the Prisma website?
    p
    j
    c
    • 4
    • 6
  • h

    Halvor

    07/07/2021, 10:22 PM
    Is there any documentation for createMany() ?
    p
    j
    • 3
    • 10
  • m

    Mukesh Kumar

    07/07/2021, 10:40 PM
    Hello everyone
  • m

    Mukesh Kumar

    07/07/2021, 10:55 PM
    Need help. I am migrating from Sequelize to Prisma.
    Copy code
    // Sequelize 
    Product.findAll({ 
    group: ['date', Sequelize.json(`type.warranty`)],
    attributes: [
          'date',
          [Sequelize.json(`type.warranty`), 'warranty'],
          [Sequelize.fn('sum', Sequelizer.col('cost')), 'price ']
        ],
    })
    How do I Grouping by JSON field?
    r
    • 2
    • 1
  • h

    Halvor

    07/07/2021, 11:53 PM
    I am trying to make a 1-to-1 relation selecting what record to update based on this relation. Here is my code: https://pastebin.com/raw/WthNKwEN
  • h

    Halvor

    07/07/2021, 11:53 PM
    Anyone knows why this is not working?
    r
    • 2
    • 1
  • s

    Soumitra Shewale

    07/08/2021, 6:23 AM
    When interfacing a PostgreSQL DB using prisma, do I still need to run
    VACUUM
    to reduce disk usage? If yes, how?
    r
    • 2
    • 3
  • j

    jignesh karamchandani

    07/08/2021, 7:14 AM
    Is it possible to change the type for a field only for comparing it with some data? If yes then please do let me know...
    r
    • 2
    • 6
  • a

    Arun Kumar

    07/08/2021, 8:14 AM
    Is it possible to force a new migration based on the current schema?
    j
    • 2
    • 8
  • m

    manuel

    07/08/2021, 8:40 AM
    If I use the https://github.com/prisma/nexus-prisma plugin I can still use nexus without it right?
    d
    • 2
    • 6
  • m

    Mykyta Machekhin

    07/08/2021, 8:45 AM
    Hello guys. Is it possible to configure query results logging?
    j
    • 2
    • 3
  • t

    Timo

    07/08/2021, 10:30 AM
    Say I use Migrate to change
    tag: String?
    to
    tags: String[]
    (changing name + type) how can I make sure that the data is being converted instead of deleted/dropped?
    d
    d
    • 3
    • 7
  • u

    user

    07/08/2021, 3:20 PM
    What's new in Prisma? (Q2/21) Learn about everything that has happened in the Prisma ecosystem and community from April to June 2021.
    prisma rainbow 3
  • a

    Arda Ilgaz

    07/08/2021, 4:03 PM
    Hi everyone,  Getting crazy with sth for a couple of days. Exact same app as previous versions, so locked versions as my latest deployments, but I started to see @prisma/client did not initialize yet errors.  Stack is aws serverless webpack, i am trying to access postgresdb over vpc Rather than a specific question, I wonder if this is happening for anybody else?
    j
    • 2
    • 1
  • a

    Ariel Flesler

    07/08/2021, 6:53 PM
    Hi everyone, I noticed that my server takes 7-8s to load (and it's pretty new). Narrowed it down to
    import { PrismaClient } from '@prisma/client'
    taking a whooping 6 seconds. Is this something you plan to optimize? anything I could do about it? It's a new project with just 8 tables/models at the moment.
    ⚠️ 1
    j
    • 2
    • 8
  • g

    Gautam Paranjape

    07/08/2021, 7:05 PM
    Why am I getting this error when I open up Prisma studio? I tried re running it and the same error popped up
    j
    • 2
    • 11
  • z

    Zestian

    07/08/2021, 8:19 PM
    Anyone know what i can do in this case? Im using prisma 2, with a postgresql database in supabase ( is a testing db doesnt matter if i show credentials)
    j
    • 2
    • 3
  • j

    jasci

    07/08/2021, 8:24 PM
    Hello everybody. Wanted to ask about optional fields that are defined in input type of my app schema. Let’s say I’ve got this input type:
    Copy code
    input UserUpdateInput {
      firstName: String
      lastName: String
      shippingAddress: AddressInput
      phone: String
    }
    And this mutation:
    Copy code
    updateUser(where: UserWhereUniqueInput!, data: UserUpdateInput!): User!
    If I run this mutation and provide only
    firstName
    and
    phone
    for example. I can see that in my resolver I have args object with 2 properties that I have provided (only
    firstName
    and
    phone
    ). The question is that I’ve seen implementations that use
    *setNull
    fields, like:
    Copy code
    input UserUpdateInput {
      firstName: String
      lastName: String
      shippingAddress: AddressInput
      shippingAddress_setNull: Boolean
      phone: String
      phone_setNull: Boolean
    }
    I’m told that the reason is that by default the fields that are optional and not provided are set to
    null
    but I don’t see that. And it’s used to distinguish if a user really wants to set the field as
    null
    or just hasn’t provided a value. But in my case I don’t see not provided values to be set
    null
    . Can you please help to understand what is the proper way to implement that? Thank you. P.S. API with Apollo Server.
  • b

    Ba Thien Tran

    07/08/2021, 9:14 PM
    Hi everyone, is it possible to update a field on an object based on the object’s current values without having to retrieve it first?
    r
    • 2
    • 1
  • h

    Halvor

    07/08/2021, 11:12 PM
    Given this schema:
    Copy code
    model match {
      id                Int                 @id @default(autoincrement())
      session_id        BigInt              @unique
      arbitrated        arbitrated?
    }
    
    model arbitrated {
      id                Int                 @id @default(autoincrement())
      match             match               @relation(fields: [matchId], references: [id])
      matchId           Int
      arbitrated_session_id       BigInt              @unique
    }
  • h

    Halvor

    07/08/2021, 11:14 PM
    Is there a better way to do this in a single query?
    Copy code
    const match = await prisma.match.findUnique({
            where: {
                session_id: 1234
            }
        });
    
        const arbitrated = await prisma.arbitrated.create({
            data: {
                match: {
                    connect: {
                        id: match.id
                    }
                },
                arbitrated_session_id: 5678
            }
        });
    r
    • 2
    • 36
  • b

    Brendan Berman

    07/08/2021, 11:41 PM
    Hi everyone! Nice to join this community. I’ve been using Prisma for close to a year on a side project with a few other developers, but as of this week, all of us are running into errors like
    Query engine binary for current platform "linux-arm-openssl-1.1.x" could not be found.
    Would really appreciate any help debugging this! I’ll drop more details into a 🧵
    j
    • 2
    • 9
  • p

    prisma chobo

    07/09/2021, 4:08 AM
    i am sorry for another question but i can’t find on google aod official docs in prisma website so im asking here. is there anyway I can create custom repository that extends certain prisma model and add methods to it? something like
    Copy code
    class MyUserCustomRepo extends PrismaClient<User> {
      customMethod() {
        // implement the function
      }
    }
    r
    g
    • 3
    • 8
  • c

    Code With Waleed

    07/09/2021, 8:18 AM
    Hey @everyone, Can anyone know where I can find the complete guide about prisma
    r
    • 2
    • 2
  • n

    Nivedita Singh

    07/09/2021, 11:01 AM
    Hi everyone, Is there a way to use aggregate and create in single query. Here I want to achieve below with prisma INSERT INTO user (name, custom_id) VALUES ("someName", (SELECT IFNULL(MAX(custom_id) + 1,1) from user where company_id = someId))
    r
    • 2
    • 9
  • a

    Angelo

    07/09/2021, 11:16 AM
    I am trying to filter by a key and value inside a JSON field (using Postgres), reading this https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#json-object-arrays So I adapted my code to try to find a value inside a JSON field like this:
    Copy code
    const application = await prisma.application.findFirst({
        where: {
          id: applicationId,
          tasks: {
            array_contains: [{ keyName: taskKeyName }],
          },
        },
      });
    basically I want to filter inside the JSON
    tasks
    field (which is an array) for a value inside
    keyName
    but I keep
    array_contains
    is unknown, I've tried to use
    equals
    but I assume that only returns data if all the array key value matches. I am a bit lost and I'm not sure why it doesn't work 😞
    r
    • 2
    • 5
  • p

    Patrick

    07/09/2021, 1:51 PM
    Hey folks. I would like to create new field in the database, and set specific value for the existing records. New records should have different value though. How would you handle it? Simply do two migrations? First - set @default for existing records, second- change @default to the value for new records?
    d
    • 2
    • 2
  • n

    Nikita Mavrychev

    07/09/2021, 2:15 PM
    Hi. When I create migration
    npx prisma migrate dev --name name-migration
    like in docs https://www.prisma.io/docs/guides/database/developing-with-prisma-migrate#create-migrations field
    applied_steps_count
    in table
    _prisma_migrations
    equals
    Null
    insted of 1. How can I fix it?
    j
    • 2
    • 1
  • b

    Ba Thien Tran

    07/09/2021, 4:25 PM
    Hi again, is it possible to pull a random amount of rows where I don’t have to do it on the server side?
    r
    • 2
    • 1
  • j

    J Giri

    07/09/2021, 9:07 PM
    I posted an issue with prisma/types-node in stackoverflow https://stackoverflow.com/questions/68322578/recent-updated-version-of-types-node-is-creating-an-error-the-previous-versi The docs of prisma client instantiation needs to be revised as it having a bug with the latest version of @types/node
    "@types/node": "^16.3.0"
    . It was working fine until day before yesterday with the version ``"@types/node": "^15.x.x"``. This is from the doc
    Copy code
    import { PrismaClient } from "@prisma/client";
    
    // add prisma to the NodeJS global type
    interface CustomNodeJsGlobal extends NodeJS.Global {
      prisma: PrismaClient;
    }
    
    // Prevent multiple instances of Prisma Client in development
    declare const global: CustomNodeJsGlobal;
    
    const prisma = global.prisma || new PrismaClient();
    
    if (process.env.NODE_ENV === "development") global.prisma = prisma;
    
    export default prisma;
    I'm getting this error
    Copy code
    error TS2694: Namespace 'NodeJS' has no exported member 'Global'.
    4 interface CustomNodeJsGlobal extends NodeJS.Global
    What could i do to make it work with latest version of
    @types/node
    ?
    r
    • 2
    • 8
1...455456457...637Latest