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

    Robin Diddams

    05/25/2022, 6:02 PM
    Hello! I’m trying out prisma for my company, got a schema built out that works and can generate the client, but I cant figure out how this is supposed to work for separate services, will each new service we build out need to have a local copy of our
    schema.prisma
    ? if you have, say, 10 different microservices, that want access to your db, how would you synchronize and version the schema across all of them?
    n
    • 2
    • 2
  • b

    Berian Chaiwa

    05/25/2022, 10:16 PM
    Hello here. A quick one: Does this seem to be the correct way to implement this relationship? I am curious about that zero or more piece:
    Copy code
    model IndicatorUnit {
      id           String @id @default(uuid()) @db.Uuid
      unit         String @unique
      display_name String @unique
      
      indicators Indicator[]
    
      @@map("indicator_unit")
    }
    
    model Indicator {
      id           String @id @default(uuid()) @db.Uuid
      
      report_type_id String
      indicator_unit_id String
      indicator_unit IndicatorUnit @relation(fields: [indicator_unit_id], references: [id])
    
      @@map("indicator")
    }
    n
    • 2
    • 6
  • r

    Rahul Taing

    05/25/2022, 11:14 PM
    any recommendations on how to use prisma to backfill data? a typical scenario we have is that we add a column to a table. All the existing records need to be updated to add a value based on some logic. How can I use prisma to insert those values to the new column on existing records?
    n
    • 2
    • 1
  • m

    Mischa

    05/26/2022, 12:03 AM
    is there a way to escape search queries when doing FTS - like if I want to search for literal
    "q & a"
    and want to escape that to not mean
    and
    n
    • 2
    • 3
  • m

    Mischa

    05/26/2022, 12:04 AM
    also is this right? dog but not cat?
    n
    • 2
    • 1
  • m

    Mischa

    05/26/2022, 12:07 AM
    I defined a tsvector column with
    search Unsupported("tsvector")?
    and then the GIN index in the migration. when I run migrations though it creates a new migration that tries to drop my GIN indexes. the docs say "You can continue using Prisma Migrate as you were before, it will ignore indexes that it doesn't know about." am I missing a step? also I can't search on my tsvector column; it doesn't appear in my generated schema
  • m

    Mischa

    05/26/2022, 12:55 AM
    also if I do
    { body: { search: "foo bar"} }
    I get an error
    syntax error in tsquery
    - if my search string contains a space it works if I do
    query.split(/\s+/).join(" & ")
    but that seems goofy
    n
    • 2
    • 2
  • d

    Debaucus

    05/26/2022, 12:59 AM
    Hey all, got a quick question about data fetching. I have 2 tables, similar but different data. When loading a page I want to load the data from table 1 or table 2 depending on the ID.. is there a way to pass data to
    Copy code
    await prisma.X.findUnique
    with X being the changing variable. OR, is this a database stucture issue and I need to rethink my design?
    o
    n
    • 3
    • 2
  • s

    Studywithdesign

    05/26/2022, 1:30 AM
    Can we add different schemas in prisma
  • s

    Studywithdesign

    05/26/2022, 1:30 AM
    As we can add many models in prisma
  • s

    Studywithdesign

    05/26/2022, 1:31 AM
    My problem is that I want to setup profile in different schema and auth in different
    n
    • 2
    • 1
  • d

    Debaucus

    05/26/2022, 3:02 AM
    Reworded my question.
  • d

    Debaucus

    05/26/2022, 3:02 AM
    I have a idea of a database structure but am unable to get a grasp on the correct layout.
    Copy code
    Server_type_1:
    - title
    - description
    - name
    - id
    - custom thing 1
    - custom thing 2 
    - custom thing x
    
    Server_type_2:
    - title
    - description
    - name
    - id
    - custom thing 1
    - custom thing 2 
    - custom thing x
    Currently, using postgresql, I'm not understanding how I could load all these options under one URL with NextJS/Prisma. Since I have to specify a table like
    Server_type_1
    for example?
    o
    n
    • 3
    • 9
  • b

    Berian Chaiwa

    05/26/2022, 5:59 PM
    Postgres supports this data type
    chkpass
    which can be handy for storing passwords but I noticed in the Prisma docs that unsupported data types will not be part of the generated client. Does Prisma have a model-level helper to achieve something similar?
    n
    • 2
    • 1
  • r

    Rahul Taing

    05/26/2022, 9:14 PM
    are there examples of using prisma client(s) to connect to more than 1 db in one project?
    n
    • 2
    • 1
  • d

    Dimitri Borgers

    05/27/2022, 4:47 AM
    Hi all, I’m using postgres and prisma and trying to create a model for a User that includes an image for their profile. What would the type of the image be in the model? Is it Bytea? I haven’t seen any examples of this.
    j
    n
    • 3
    • 7
  • n

    Naoki Watanabe

    05/27/2022, 8:26 AM
    Hi. This might be silly question, but if you make typescript based API and Frontend (Typescript and some mobiles), will you make a monorepo for API and Frontend, and make another repo for mobile? I’m wondering the best practice for making API type safely.
    o
    n
    • 3
    • 3
  • a

    Abhishek Sanghani

    05/27/2022, 11:15 AM
    Hi there, Suppose I want a column in a table to only have int's in the range [0,5], i.e. {0,1,2,3,4,5}, how do I specify that in the prisma schema file? Using this with postgresql. Would use this to implement ratings in my database.
    n
    • 2
    • 2
  • d

    Deepak Guptha S

    05/27/2022, 12:05 PM
    Hello, I get this exception, when I try to perform
    nest start -w
    I have already tried with deleting and reinstalling the
    node_modules
    I defined prisma schema
    Copy code
    generator client {
      provider      = "prisma-client-js"
      output        = "./generated/client"
    }
    How to resolve the issue ?
    n
    • 2
    • 2
  • s

    Sönke Peters

    05/27/2022, 3:42 PM
    Hi, are there official brand resources (especially logos) for Prisma available somewhere? I’m building an open source project that uses Prisma and would like to use the Prisma logo in the docs.
    n
    • 2
    • 2
  • k

    Keshav Tangri

    05/28/2022, 3:58 AM
    Hi Guys, I am currently learning and exploring prisma3 for MySQL. I am unable to find relevant docs for prisma support for GraphQL Subscriptions. In V1, it was done via prisma-bindings, however I am not sure about v3.
    d
    n
    • 3
    • 4
  • v

    Vivek Poddar

    05/28/2022, 9:07 AM
    Hi all, I am trying to use Prisma in my AWS lambda to connect it to the Planetscale DB, on local it works fine but after I deploy I am getting the following error in the lambda console:
    Copy code
    "@prisma/client did not initialize yet. Please run \"prisma generate\" and try to import it again.\nIn case this error is unexpected for you, please report it in <https://github.com/prisma/prisma/issues>",
    I have checked and can see
    @prisma/client
    in the
    ./node_modules
    not sure what is missing
    d
    n
    • 3
    • 13
  • g

    Geebrox

    05/28/2022, 10:13 AM
    I am getting an error when trying to delete data that doesn’t exist on db. Is it possible to tell prisma to not throw an error if the requested data doesn’t not exist? I am using mongoDB and
    delete
    method.
    Copy code
    await this.prismaService.task.delete({ where: { name } });
    name
    field is unique
    o
    n
    • 3
    • 2
  • j

    Joseph

    05/28/2022, 10:39 AM
    Hey @here, is it possible to use both SQL and NoSQL (say Postgres and MongoDB) together in Prisma ORM?
    n
    • 2
    • 1
  • s

    Samuel Corsi-House

    05/28/2022, 1:44 PM
    How can I make a custom array in Prisma Schema. Eg. an array like this
    { reason: string; moderator: string }[]
    n
    • 2
    • 3
  • a

    Alain Dwight

    05/28/2022, 1:50 PM
    for migrating to from Prisma 1 Cloud, is there any way to get prisma 1 export into a mysql database without first spinning up a self hosted prisma 1 server, importing there, then upgrading that to prisma2?
  • a

    Alain Dwight

    05/28/2022, 1:51 PM
    basically, is there any way I can take my Prisma 1 export in NDF/JSON format and convert it to SQL or something?
    n
    • 2
    • 1
  • a

    Alain Dwight

    05/28/2022, 1:54 PM
    ahh, I guess if I go in prisma cloud it lets me get my the responses from my queries in json format, is translating that into SQL the best bet?
  • v

    Vivek Poddar

    05/28/2022, 2:53 PM
    I see that this is the generated output in y Github actions, any idea?
    Copy code
    class PrismaClient {
      constructor() {
        throw new Error(
          `@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
    In case this error is unexpected for you, please report it in <https://github.com/prisma/prisma/issues>`,
        )
      }
    }
    
    module.exports = {
      PrismaClient,
    }
    m
    n
    • 3
    • 9
  • e

    Ezekiel Adetoro

    05/28/2022, 9:45 PM
    Heelo Guys
    👋 3
1...579580581...637Latest