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

    Ali

    08/31/2022, 8:56 AM
    only on my production environment
  • a

    Alef Solution2020

    08/31/2022, 9:09 AM
    Hello! Can someone help me with this data restore issue? We are moving the prisma1 layer from the deprecated cloud to our self hosted prisma1 docker container, we used mysql native data export/import for data migration (to a new mysql 5.7 instance) and everything seems to be connected, but the graphql server returns "the project next@xyz not found" We've even restored the
    prisma
    graphcool
    dbs to the new db What could be the issue?
    ✅ 1
    n
    a
    • 3
    • 9
  • f

    Fishie

    08/31/2022, 9:16 AM
    Copy code
    model User {  
      id Int @id
      name String
    
      roles Role[]
    }
    
    model Role {
      id Int @id
      name String
    
      users User[]
    }
    How can i return something like this?
    Copy code
    [
      {
        id: 1,
        name: "John",
        roleIds: [1,2,3]
      }
    ]
    ✅ 1
    n
    • 2
    • 4
  • d

    Dazzpowder

    08/31/2022, 10:33 AM
    Hi! which IDE plugin should devs use with intellij Prisma Support or Prisma
    ✅ 1
    r
    • 2
    • 3
  • e

    Emanuele Ricci

    08/31/2022, 10:39 AM
    Hi there, I'm using Prisma on a nodejs app that iterates over many records. I instantiate a prisma client and pass it down the line, only after all the records have been processed I disconnect it. I'm getting this error
    ConnectorError(ConnectorError { user_facing_error: None, kind: ConnectionError(Timed out during query execution.) })
    so I'm afraid that maybe I'm not using it in the correct way? note: I'm using it locally with sqlite for testing purposes
    👀 1
    r
    a
    v
    • 4
    • 5
  • z

    Zahra Mumtaz

    08/31/2022, 10:59 AM
    Hi, I’m trying to search phone number in format
    <tel:+15952999918|+1(595)299-9918>
    using contains query but it’s not giving any result on special characters. Any help?
    👀 1
    r
    • 2
    • 5
  • j

    Jonathan

    08/31/2022, 11:17 AM
    Do people have any interesting abstractions around prisma to improve the DX (Developer experience) of their application? We notice we are often rewriting similar queries (but sometimes different relations, with nested includes which seem to occur often enough). We have been trying to write classes resembling Laravel’s Eloquent, but it’s not straightforward enough yet.
    ✅ 1
    n
    d
    • 3
    • 6
  • t

    Taylor Lindores-Reeves

    08/31/2022, 11:54 AM
    I restarted my vscode after updating to v4.3.0
  • t

    Taylor Lindores-Reeves

    08/31/2022, 11:54 AM
    Tried adding filteredRelationCount but it doesn’t exist apparently.
  • t

    Taylor Lindores-Reeves

    08/31/2022, 11:54 AM
    Reran prisma generate multiple times
    ✅ 1
    n
    • 2
    • 3
  • j

    Jason Marmon

    08/31/2022, 10:16 PM
    i’m having this exact issue - https://prisma.slack.com/archives/CA491RJH0/p1649822875073299 I’m trying to add
    pg_tgrm
    - i added a migration with
    --create-only
    , added this to the `migration.sql`:
    Copy code
    CREATE EXTENSION IF NOT EXISTS pg_trgm;
    CREATE INDEX IF NOT EXISTS "my_trgm_idx" ON "Stuff" USING gin ("title" gin_trgm_ops)
    and then when I run
    yarn prisma migrate dev
    prisma creates a new migration dropping the index. this is on prisma
    4.2.1
    . any ideas what I can do to prevent this?
    👀 1
    ✅ 1
    n
    • 2
    • 2
  • a

    Alex Vilchis

    08/31/2022, 11:43 PM
    Hi there. Is there a way to run
    prisma generate
    without throwing an error if the variable
    DATABASE_URL
    is not present? I need to just build my app. Any issue where I could track this?
    ✅ 1
    b
    b
    r
    • 4
    • 3
  • b

    Ben Broich

    09/01/2022, 6:01 AM
    Good Morning from Germany! Is it somehow possible, if I’ve two models (Products and “one-to-many” ProductMetrics), to do product.findMany() and now sort the products based on some fields inside the ProductMetrics model? As far as I’ve seen it’s only possible to filter by one-to-many relationships and sorting works only for one-to-one. In plain MySQL, it would be something like ORDER BY the results of a sub-select statement.
    ✅ 1
    n
    • 2
    • 7
  • k

    Krunal modi

    09/01/2022, 9:03 AM
    Hi there, We're using RDS instance size m5.2xLarge where mysql setup with connection limit of 25 and pool timeout of 10 sec. But we're getting pool timeout error every time when many users tries to connect parallelly with an application, we've around 20K active users and a time there is an average 200 user tries to connect. Can anyone guide me like how can I tune these parameters or what changes are possible to fix this issue.
    👀 1
    r
    v
    • 3
    • 6
  • a

    Arpan Bagui

    09/01/2022, 11:20 AM
    Hi There, I have a field in prisma model called
    modified_at
    which is defined like
    DateTime @updatedAt
    now I want to check if modified_at is more than 4 hrs using prisma query. Is it possible? Can anyone help me on that. Thank you
    ✅ 1
    n
    • 2
    • 4
  • m

    Mohit Gangrade

    09/01/2022, 11:35 AM
    Hi, Why do I see a huge number of errors in the generated Prisma client when I try to compile Typescript? This is my config:
    Copy code
    {
      "compilerOptions": {
        "sourceMap": true,
        "outDir": "dist",
        "strict": true,
        "lib": [
          "ESNext"
        ],
        "esModuleInterop": true
      }
    }
  • m

    Mohit Gangrade

    09/01/2022, 11:35 AM
    The code works fine when I run it with
    npx ts-node
  • m

    Mohit Gangrade

    09/01/2022, 11:39 AM
    Copy code
    npm install @prisma/client
    It worked after I ran this command.
    ✅ 1
    n
    n
    • 3
    • 4
  • m

    Mohit Gangrade

    09/01/2022, 11:40 AM
    This command isn't there in the Quick start guide. Maybe you should add it there? 🙂
    ✅ 1
    n
    • 2
    • 1
  • b

    Baalamurgan K A

    09/01/2022, 12:03 PM
    Invalid
    prisma.user.create()
    invocation:\n\n\nPrisma needs to perform transactions, which requires your MongoDB server to be run as a replica set
  • b

    Baalamurgan K A

    09/01/2022, 12:03 PM
    If someone knows how to fix this. Lemme know.
  • b

    Baalamurgan K A

    09/01/2022, 12:04 PM
    To run locally.
    ✅ 1
    n
    • 2
    • 5
  • j

    Jason

    09/01/2022, 1:07 PM
    Does anyone have any tips on doing migrations on large tables? I need to add an index to a table with 900m rows, not sure if a straightforward
    migrate deploy
    is capable enough, or if I need to do something special
    ✅ 1
    n
    • 2
    • 1
  • n

    Nurul

    09/01/2022, 4:01 PM
    Hi Nilay 👋 Are you still facing this issue?
    n
    • 2
    • 2
  • h

    Hays Clark

    09/01/2022, 4:29 PM
    Prisma + Apollo Server + Auth0 question: I have an existing site using Auth0, and we are spinning up a new product that will have its own GraphQL Resource API (using Prisma + Apollo Server). I have plumbed in Auth0 authorization into my new Apollo Server, and now I can make "Authenticated" calls to my new Resource Service; however, there is no "User" object in my Database for these existing Auth0 users. What is the typical way to handle this scenario? (Where you have an existing "known user" in your Authentication Service, but that user is "new/unknown" in the resource service...)
    i
    • 2
    • 8
  • v

    Varshith Kumar

    09/01/2022, 4:48 PM
    Hey guys. Is there a good reference on how to use prisma in production? Bit scared and hesitant with all the data losses that happens when migrating in development.
    ✅ 1
    n
    n
    b
    • 4
    • 9
  • f

    Franklin

    09/01/2022, 5:51 PM
    Hello, I was wondering if there is a tool or package that can transform a sql table into a prisma model. For example I have this table:
    create
    *table* asset_collection (
    id
    *integer* auto_increment not null,
    department
    *varchar*(255),
    reviewed
    *varchar*(255),
    curr_status
    *varchar*(255),
    bay_location
    *varchar*(255),
    created_by
    *integer*,
    updated_by
    *integer*,
    created_at
    *datetime*(6),
    updated_at
    *datetime*(6),
    location
    *varchar*(255),
    prep
    *integer*,
    case_barcode
    *varchar*(255),
    *constraint* pk_asset_collection *primary*
    *key* (id)
    ); And I want to transform it to a model for prisma.
    ✅ 1
    r
    • 2
    • 2
  • c

    Charlie

    09/01/2022, 6:51 PM
    Copy code
    model Album {
      id            BigInt            @id @default(autoincrement())
      artist        String
      title         String
      genres        GenresOnAlbums[]
    }
    
    model Genre {
      @@map("genres")
    
      id        BigInt            @id @default(autoincrement())
      slug      String
      genre     String
      albums    GenresOnAlbums[]
    
      @@index([slug])
    }
    
    model GenresOnAlbums {
      id        BigInt  @id @default(autoincrement())
      albumId   BigInt
      genreId   BigInt
      subGenre  Boolean @default(false)
      rym       Boolean @default(false)
      albums    Album   @relation(fields: [albumId], references: [id], onDelete: NoAction, onUpdate: NoAction)
      genres    Genre   @relation(fields: [genreId], references: [id], onDelete: NoAction, onUpdate: NoAction)
    }
  • c

    Charlie

    09/01/2022, 6:55 PM
    Hi, I’m trying to write a query using prisma/client on a postgres DB to add a Genre to an Album, and also set the field
    subGenre
    when I create the link. I currently have this, but the
    subGenre
    part is giving an error.
    Copy code
    const album = await prisma.album.update({
      where: { id: 51 },
      data: {
        genres: {
          connect: { id: 34 },
          subGenre: false,
        },
      },
    });
    console.log(album);
    And below is my schema
    Copy code
    model Album {
      id            BigInt            @id @default(autoincrement())
      artist        String
      title         String
      genres        GenresOnAlbums[]
    }
    
    model Genre {
      id        BigInt            @id @default(autoincrement())
      genre     String
      albums    GenresOnAlbums[]
    }
    
    model GenresOnAlbums {
      id        BigInt  @id @default(autoincrement())
      albumId   BigInt
      genreId   BigInt
      subGenre  Boolean @default(false)
      albums    Album   @relation(fields: [albumId], references: [id], onDelete: NoAction, onUpdate: NoAction)
      genres    Genre   @relation(fields: [genreId], references: [id], onDelete: NoAction, onUpdate: NoAction)
    }
    👀 1
    t
    n
    • 3
    • 7
  • h

    Hubert Kowalski

    09/01/2022, 9:21 PM
    I want to remove bloaty old migrations and start from there. How should I approach that? I know that docs state that I shouldn't be doing this, but I've been just messing around and created a lot of unnecessary migrations 😛
    👀 1
    ✅ 1
    c
    n
    • 3
    • 2
1...615616617...637Latest