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

    Giorgio Delgado

    06/07/2021, 7:00 PM
    Solved ✅ Solution is
    show CREATE TABLE <table name>;
  • w

    Wuxxy

    06/08/2021, 2:58 AM
    Is there a good way I can implement like an expire thing - where a record is deleted after a certain amount of time
    s
    d
    • 3
    • 2
  • s

    Sascha Ormanns

    06/08/2021, 7:52 AM
    Hey, I was wondering if there is a way to retrieve changesets on/after operations, especially when using nested writes or updates. Im aware of include, but this gives me all related records of an included relation, is there a way to retrieve only the created or changed relations?
    r
    • 2
    • 4
  • l

    Levi Lawliet

    06/08/2021, 8:15 AM
    Hi I was hoping if anyone had any ideas on this: https://prisma.slack.com/archives/CA491RJH0/p1623085340153700
  • s

    shahrukh ahmed

    06/08/2021, 8:50 AM
    Hi everyone, have spend the last few hours working with Prisma and it has been fun. But, I can't find any docs or tutorial on image/file uploads. My previous experience with database has been with Django, Postgres & a library called Pillow.
    d
    r
    • 3
    • 10
  • d

    Dev__

    06/08/2021, 9:43 AM
    hello, when I want to delete a row that has a required relation I get a P code within a
    catch
    , but when I do this with a
    transaction
    I do not get any error info at all, only a
    clientVersion
    . Is there a way to get the same error info as when I am not using a
    transaction
    d
    j
    • 3
    • 6
  • d

    Daniel Olavio Ferreira

    06/08/2021, 10:14 AM
    Hey guys, does anyone know how to get the types from the models, so I can extend a type of mine? I tried getting it from .prisma/client/index.d.ts but when I extend my interface it doesnt recognize it and when I create a new type based on it, it thinks its of type any
    Copy code
    import { Users } from ".prisma/client/index.d.ts";
    
    export type User = Users;
    🙌 1
    r
    d
    • 3
    • 3
  • n

    Nichita Z

    06/08/2021, 12:20 PM
    Hi all! I’ve been using prisma for a month or so and it’s amazing for many things, but I’ve hit a weird use case, would appreciate any help
  • n

    Nichita Z

    06/08/2021, 12:20 PM
  • n

    Nichita Z

    06/08/2021, 12:21 PM
    Basically I want to update some comments with 2 operations: 1. content = pendingContent 2. pendingContent = null
  • n

    Nichita Z

    06/08/2021, 12:22 PM
    The second step is easy, but I’m not sure how to do the first one.. another way would be to just findMany and update them individually, but I think it would be much faster if I could solve it in one query?
    r
    d
    n
    • 4
    • 4
  • d

    Daniel Olavio Ferreira

    06/08/2021, 1:08 PM
    Does anyone know an alternative to PgBouncer for SQL Server?
    a
    • 2
    • 2
  • j

    Jake Quinter

    06/08/2021, 1:33 PM
    Anyone have Prisma working with Apollo in Next.js SSR/SSG?
    r
    d
    • 3
    • 7
  • b

    brettski

    06/08/2021, 1:40 PM
    I am new to Prisma Migrate and am wondering if it is a good idea to do database backups prior to each production migration (MySql). My though is
    yes
    , why take a chance. What have you found to be the best practice around this?
    r
    • 2
    • 2
  • j

    jasci

    06/08/2021, 2:45 PM
    Hello everybody. I’m currently upgrading from prisma1 to prisma2(prisma-binding to sdl-first approach). I’ve got some questions regarding schemas. In order to use prisma1 as well as prisma2 we need at least 2 schemas: datamodel(define types that map to the database tables) and application schema(what clients can query from the API, in my setup it’s fed to the ApolloServer) It’s assumed in the upgrade tutorials that an app schema is defined through importing types from prisma service(generated). I’ve got a prisma1 setup(wasn’t written by me) which uses: • datamodel schema • full schema(downloaded from the graphql playground, it’s used to generate some fragments, not to extend an app schema with some type definitions) • application schema(written manually without any imports) . Also there is a lot going on in the code, some custom attributes, manipulations with the schema, replacements, etc. I plan to do the following and wanted to ask if this is the right direction to get at least a basic functionality ? 1. Migrate my prisma2 schema to the DB. I used dev DB that was created by the prisma1 datamodel to create prisma2 schema. Now I want to create a new DB based on the prisma2 datamodel and rerun all tests against it later. 2. Refactor all the resolvers to use prisma2 client, then check with tests. Cannot quite understand why do I need to download full schema from the graphql playground? Where it fits ? Thank you.
    n
    • 2
    • 3
  • b

    brettski

    06/08/2021, 3:30 PM
    Is there a command like
    prisma migrate status
    which can return only if schema is up-to-day, all migrations applied.
    status
    does this but also contains a lot of other info making it difficult to parse. I am looking to us it for script logic conditions.
    d
    j
    • 3
    • 11
  • n

    Nichita Z

    06/08/2021, 3:32 PM
    Anyone know why I wouldn’t be able to use this feature https://github.com/prisma/prisma/issues/5078 in my code? Apparently it should generate types including a ‘push’ object, not just set, but it seems to be missing
  • n

    Nichita Z

    06/08/2021, 3:32 PM
    d
    • 2
    • 12
  • n

    Nichita Z

    06/08/2021, 3:33 PM
    And my prisma schema contains
    likes User[] @relation(name: "liked")
    which seems correct
  • k

    Kent C. Dodds

    06/08/2021, 4:05 PM
    yo 👋
    👋 11
    prisma rainbow 10
    m
    • 2
    • 1
  • a

    Andres - Andreshvas

    06/08/2021, 7:10 PM
    hey how can i split my schemas into multiple files?
    b
    • 2
    • 2
  • a

    Alexander Lang

    06/08/2021, 9:23 PM
    Has anyone gotten this before?
    Copy code
    GraphQLError: PANIC in query-engine/connectors/sql-query-connector/src/database/operations/write.rs:95:60
    called `Result::unwrap()` on an `Err` value: ScalarFieldNotFound
    I downgraded from 2.24 to 2.21 and it disappeared. The error seemed to indicate that some column couldn't be found.
    j
    b
    • 3
    • 2
  • j

    Julian

    06/08/2021, 9:53 PM
    Hi! Is there any way to get the
    data
    and
    count
    in one function call? TypeORM has a function for this called
    .findManyAndCount()
    and I was wondering if Prisma had something similar. I found
    .count()
    but this is results in two calls: one for the data, and one for the count. This can get quite complex with relations and joins, adding a lot of code and overhead. Would be great if there is a way to combine them 🙂
    r
    • 2
    • 10
  • d

    Daniel Olavio Ferreira

    06/09/2021, 6:05 AM
    Hello @Jesús Quirós, I'm not sure if this is the problem but could you try using the
    uuid()
    function inside of the
    @default()
    . Maybe that can be causing prisma to regenerate something or to reload data in some way. Because its trying to create new uuids
    j
    • 2
    • 2
  • e

    Emeka Mamah

    06/09/2021, 12:36 AM
    Hello. Has anyone ever ran
    prisma migrate dev
    successfully on a heroku postgres database?
    r
    • 2
    • 1
  • m

    migz

    06/09/2021, 5:35 AM
    not sure where else to post but having a bit of trouble wrapping my head on this.
  • m

    migz

    06/09/2021, 5:36 AM
    Copy code
    model Category {
      id    Int    @id @default(autoincrement())
      name  String
      posts Post[]
    }
    
    model Post {
      id         Int        @id @default(autoincrement())
      title      String
      content    String?
      categories Category[]
    }
  • m

    migz

    06/09/2021, 5:36 AM
    how would one go about seeding a many to many relation like this? Assuming you had a json similar to this
    Copy code
    [
       { 
          name: 'some name', 
          posts: [ { title: 'title', content: 'some content' }, ....]
       },
      { ....} 
    ]
    r
    • 2
    • 11
  • a

    Arun Kumar

    06/09/2021, 7:45 AM
    I'm facing this error while trying to update a record
    {"error":{"clientVersion":"2.23.0"}}
  • d

    Daniel Laera

    06/09/2021, 7:48 AM
    @Arun Kumar can you share the stack trace?
1...440441442...637Latest