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

    Pieter

    11/01/2021, 2:05 PM
    this ticket link of mine is broken. Not sure why https://prisma.io/serverless/tickets/208
    r
    • 2
    • 3
  • c

    Cleberson Saller

    11/01/2021, 2:40 PM
    Hello, I have a use case where I need to call a function in an Upsert call, but only if that upsert creates a new entry in the database. Is there any callback method inside the Upsert properties or any method I can use?
    t
    r
    • 3
    • 2
  • d

    Dia TM

    11/01/2021, 3:27 PM
    Do you know why the foreign key constraint fail on the
    postId
    column? https://stackoverflow.com/questions/69776608/why-did-the-foreign-key-constraint-fail-on-the-column-postid I described the problem, but there is no answer.
    r
    • 2
    • 2
  • u

    ut dev

    11/01/2021, 4:53 PM
    What should I do if I have a BigInt type?
    Copy code
    error - FetchError: invalid json response body at <http://localhost:3000/api/snippet> reason: Unexpected token < in JSON at position 0
    error - TypeError: Do not know how to serialize a BigInt
    a
    r
    • 3
    • 2
  • f

    friebetill

    11/01/2021, 6:48 PM
    Hey, is it normal to keep the migrations scripts or do you delete them after the migration?
    a
    • 2
    • 1
  • y

    Yaakov

    11/01/2021, 6:52 PM
    Hi, is there any module that can generate Swagger/OpenAPI specification from Prisma or vice versa?
    r
    • 2
    • 1
  • y

    Yaakov

    11/01/2021, 6:56 PM
    Hi, does anyone know if there's any work being done for a Prisma WebStorm plugin that is up-to-par with the VS Code version?
    r
    • 2
    • 1
  • d

    Danny

    11/01/2021, 7:37 PM
    Hey all... I was wondering if someone could help me with some some Prisma/SvelteKit issues I'm having. Since PrismaClient isn't an ES module I have a shim to make it work both during development and in build for production. But now I'm having an issue with too many prisma clients being instantiated due to hot module reloading (during development) and I can't figure out how to use a global variable in TypeScript to store the client in the global across module reloads. Was wondering if anybody could help me figure out a solution? First screenshot is the shim for ESM and the second screenshot is Prisma's recommended way in the docs to store the prisma client in a global variable for reuse across hot module reloads during development
    • 1
    • 1
  • g

    genedy

    11/01/2021, 8:30 PM
    could i divide schema.prisma file into many models and import them ?
    r
    • 2
    • 1
  • g

    genedy

    11/01/2021, 8:30 PM
    as I have a lot of models in database which made the file very big
  • a

    Austin Zentz

    11/01/2021, 8:38 PM
    not yet link
  • p

    perp

    11/02/2021, 8:39 AM
    Greetings. Has anyone been doing date related queries with prisma? Lets say I wanted to do a findfirst query with a where option object to find a record from a specific date, But I do not know the hours, minutes or seconds of the date recorded in the database. Anyone got some tips?
    s
    • 2
    • 2
  • r

    Rodrigo Oliveira

    11/02/2021, 11:12 AM
    Hi there! We are on data proxy early access program and realized we want a way to bypass data proxy when running our CI/CD tests. Do you currently have an undocumented way of doing this or would it require a script to rewrite schema.prisma config only for tests?
    r
    p
    • 3
    • 5
  • r

    Reuben Porter

    11/02/2021, 11:49 AM
    Hi all, what is the best way to run a
    deleteMany
    query where I have two where clauses, with one being an array of ids. For a basic example:
    Copy code
    model SurveyPermission {
      id           
      userId 
      surveyId 
    }
    
    const userIds = ['1', '2', '3'];
    const surveyId = 'survey-id';
    
    delete many from surveyPermissions where surveyId === surveyId && userId === one of userIds array
    I thought I could use
    has
    but can't seem to get it working as I think that's just for enums. Obviously I could do this in a loop and use a single delete but ideally wanted to handle it in a single query .
    r
    • 2
    • 11
  • u

    user

    11/02/2021, 12:48 PM
    What's new in Prisma (v3.4.0)

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

    Niko and Alex from the Prisma team discuss the latest 3.4.0 release of Prisma and other news from the Prisma ecosystem. Tune in to learn about new releases, how to upgrade, planned features, and other interesting bits from the Prisma world.
    👀 1
  • j

    Joshua Ramin

    11/02/2021, 1:12 PM
    is there anyone who build e-commerce using prisma?
    👀 2
  • m

    Mateusz Żmijewski

    11/02/2021, 1:18 PM
    Hey, I have a problem with generated migrations. In them table names are all lowercase ie. chatline but my actual table names are like chatLine and it leads to errors when migrating on production. Actually my model name is ChatLine but there is @@map("chatLine")
    r
    • 2
    • 11
  • j

    Joshua Ramin

    11/02/2021, 1:25 PM
    Here is my problem, I want to add all the products to the cart based on the productID but whenever I use to create or createMany prisma give me an error to fill the other value but I don't want to create a new entry, I only want to get the existing data (on products based on ID ) to put in the args. or should I add another table?
    r
    • 2
    • 8
  • b

    Bård

    11/02/2021, 1:44 PM
    Copy code
    model User {
      id            String          @id @default(cuid())
      name          String?
      email         String?         @unique
      role          Json            @default("[ \"user\" ]")
      emailVerified DateTime?
      createdAt     DateTime        @default(now())
      updatedAt     DateTime        @updatedAt
      Account       Account[]
      Session       Session[]
      profile       Profile?
      seed          Seed[]
      weeklyWinner  WeeklyWinners?
      userQuestions UserQuestions[]
    }
    
    model UserQuestions {
      id        Int      @id @default(autoincrement())
      answer    Json?
      submitted Boolean? @default(false)
    
      uid             String
      questionnaireId Int?
    
      user          User           @relation(fields: [uid], references: [id])
      questionnaire Questionnaire? @relation(fields: [questionnaireId], references: [id])
    
      @@unique([uid, questionnaireId])
    }
    Considering these tables in my schema, i'm trying to get all users which have a relation to UserQuestions with the prop "submitted" to true. This is my query:
    Copy code
    prisma.user.findMany({
      where: {
        userQuestions: {
          every: {
            submitted: true,
          },
        },
      },
      select: {
        email: true,
        userQuestions: true,
        name: true,
        profile: true,
      },
    });
    For some reason, this returns ALL users, including users who have no relation to UserQuestions. Any idea what is wrong here?
    ✅ 1
    r
    • 2
    • 7
  • y

    Yaakov

    11/02/2021, 2:45 PM
    Is there any way to declare a calculated field on a model? Example of what I'd like to do:
    Copy code
    model User {
      id         Int    @id @default(autoincrement())
      first_name String
      last_name  String
      full_name  String @calculated({first_name} + {last_name})
    }
    If not, is there any recommended convention for doing this?
    a
    • 2
    • 6
  • k

    Kelly Copley

    11/02/2021, 4:07 PM
    Is there a reason that an update operation throws a type error on the data parameter when a field that is required in the prisma schema is not present? This makes sense for a create operation, but an update could just be updating a single field, in which case the extra fields would not be necessary. How's everyone else handling this, are you passing an entire row of data, just to update a single field?
    j
    • 2
    • 12
  • a

    Alan

    11/02/2021, 4:33 PM
    Can we do a sum group by Month? Each row has a date (dateTime format)?
    r
    • 2
    • 2
  • j

    jruiseco

    11/02/2021, 5:09 PM
    prisma-client-rust anytime soon?
    r
    • 2
    • 1
  • j

    Jeff Richie

    11/02/2021, 5:15 PM
    Greetings! Is the read-replica support coming down the pike at all? Maybe a good question for @Alberto Perdomo.
    a
    m
    • 3
    • 5
  • j

    Joshua Ramin

    11/02/2021, 6:14 PM
    hello again, how to replicate the cartID on the empty ones since they are the same entry should I use prisma.$transation (to implement it)or there is any implementation on it? Thank u
    r
    • 2
    • 8
  • r

    Rodrigo Oliveira

    11/02/2021, 7:14 PM
    Hi there, We are using Prisma Data Proxy and getting the below errors from time to time in our Vercel serverless functions. Do any of you know what could be causing it? Are we exceeding any limits?
    r
    n
    a
    • 4
    • 20
  • r

    Rene Nielsen

    11/02/2021, 10:33 PM
    Hi guys. Im having a problem with querying
    gte
    on a number. I have some test documents, they contain a rating (number). When i do a query that looks like this:
    Copy code
    rating: {
      gte: 3.5
    }
    I only get
    5
    results. Whereas im expecting
    8
    (Look at the list in the images). If i do on the other hand make a small "hack" and subtract -00000.1 it works and i get 8. The 0.00001 was for testing, but confirmed my expectations.
    Copy code
    rating: {
      gte: 3.5-0.00001
    }
    If i do the query in mongodb shell i get
    8
    so its somewhere in the prisma client something is not doing as expected. Im using
    prisma 3.3.0
    with mongodb
    r
    • 2
    • 2
  • c

    Chris Tsongas

    11/02/2021, 11:36 PM
    Curious why not null fields with a default value are required by Prisma Client when creating a record?
    r
    • 2
    • 13
  • e

    Ethan Joffe

    11/03/2021, 12:07 AM
    I am trying to migrate from postgres to sqlite but it appears sqlite prisma client does not have
    createMany
    ? What is the current best practice workaround?
    r
    j
    • 3
    • 7
  • n

    Nima

    11/03/2021, 9:20 AM
    Hey is anyone using DataTables and stored procedures with Prisma (TS)? I haven't found any working examples
    j
    r
    • 3
    • 3
1...502503504...637Latest