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

    Bastien Etienne

    06/08/2022, 8:58 AM
    this is the schema simplified :
    Copy code
    model cibest_user {
      id           String    @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
      date_created DateTime  @default(now()) @db.Timestamp()
      first_name   String    @db.VarChar(64)
      last_name    String    @db.VarChar(64)
      email        String    @unique @db.VarChar(64)
      password     String    @db.VarChar()
      login        String    @unique @db.VarChar(32)
      //ldap_account
      // ldap_id
      networks     network[]
      tokens token[]
    }
    
    enum typeToken {
      EMAIL
      API
    }
    
    model token {
      id            String    @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
      date_created  DateTime?  @default(now()) @db.Timestamp()
      date_updated  DateTime?  @db.Timestamp()
      type_token    typeToken
      refresh_token String    @db.VarChar()
      valid         Boolean   @default(false)
      expiration    DateTime  @db.Timestamp()
      email_token   String?    @db.VarChar()
    
      //relation field
      cibest_user_id String @db.Uuid
    
      cibest_user cibest_user @relation(fields: [cibest_user_id], references: [id])
    }
  • v

    Vivek Poddar

    06/08/2022, 10:20 AM
    Hi all, is there any shortcut to have
    createdAt
    and
    updatedAt
    fields on all Models? right now I have to type them for each one of them, there are few exceptions though
    ✅ 1
    r
    n
    • 3
    • 2
  • a

    Aurora

    06/08/2022, 11:17 AM
    Hi everyone, I am a beginner and I read document but have confusion: What's the meaning of “include” and what is the difference between “select” and “include”. Thank you
    ✅ 2
    n
    • 2
    • 4
  • a

    AmirHossein Ahmadi

    06/08/2022, 12:18 PM
    Hi there. In a production environment (VPS), is it necessary to run
    prisma client generate
    every time after
    prisma migrate deploy
    ?
    ✅ 1
    n
    • 2
    • 2
  • a

    AmirHossein Ahmadi

    06/08/2022, 12:20 PM
    Or is the client generated automatically when you run
    prisma migrate deploy
    ?
    ✅ 1
    n
    • 2
    • 1
  • a

    arnob chowdhury

    06/08/2022, 12:40 PM
    Hi, probably this question was asked a thousand times before but I cannot find a definitive answer. I am building a small Express.js app. Is there any way I can use sqlite for development and postgres in production with Prisma? I tried to do it with env variables but it complained.
    ✅ 1
    n
    t
    • 3
    • 5
  • a

    AmirHossein Ahmadi

    06/08/2022, 4:48 PM
    Is database seeding a devevlopment-only concept? In other words, is it specific to development environments? Because the seed scripts don't seem to be executed in production?
    ✅ 1
    n
    c
    • 3
    • 4
  • m

    Mischa

    06/08/2022, 6:04 PM
    getting this error, any idea what it could mean?
    {"code":"P2002","clientVersion":"3.14.0","meta":{"target":["someColumn"]}}
    ✅ 1
    r
    • 2
    • 2
  • a

    Amol Patel

    06/08/2022, 6:54 PM
    Hey! is there a way to combine an “orderBy” with a count of relations? https://www.prisma.io/docs/concepts/components/prisma-client/aggregation-grouping-summarizing#return-a-relations-count-with-include
    ✅ 1
    a
    • 2
    • 3
  • d

    Dog

    06/08/2022, 7:01 PM
    Hi guys, I've been wondering about this but I'm not sure how to go about it. How should I store users in my database that can login via email/password or social authentication (like google)? I was thinking maybe I make it so I can store the login data in another model (so a model for email/password and another for social auth) and a succesfull login gives me a token that I can use to access the main User model. ofc the token is already given to me with social auth, but for email/password I would make a custom one. Still, I'm not sure about this since it's just a random idea I had. How do you guys implement this? Also, I'm using NextJS.
    ✅ 1
    j
    t
    • 3
    • 10
  • a

    Abraham Elmahrek

    06/08/2022, 7:52 PM
    Hey folks, is there a way to add additional indices without it being managed by the ORM? ie. @@ignore on indices? My more complex indices keep getting destroyed with I run migrate or deploy.
    👀 1
    a
    • 2
    • 3
  • r

    R

    06/08/2022, 11:10 PM
    How would I go about adding list push for cockroachdb? The syntax seems identical to postgres, but the generated client doesn't have for cockroach
    ✅ 1
    n
    • 2
    • 5
  • j

    Junyu Yang

    06/09/2022, 5:36 AM
    Not sure if this the right channel to ask questions apologize upfront.
  • j

    Junyu Yang

    06/09/2022, 5:36 AM
    I’m getting this error at Vercel but the app compile (yarn build) and run perfectly in local env.
    ✅ 1
    n
    • 2
    • 2
  • j

    Junyu Yang

    06/09/2022, 5:37 AM
    My schema is forcing unique for that column (email). What’s the issue here?
  • j

    Junyu Yang

    06/09/2022, 5:37 AM
    ✅ 1
    r
    • 2
    • 2
  • j

    Junyu Yang

    06/09/2022, 5:37 AM
    🙏
  • t

    Thangavel P

    06/09/2022, 5:55 AM
    Hi I need a help to figure out 1. how to validate uniqueness of a column 2. Foriegn key constraint using postgres 3. How to achieve above things in DTO?
    ✅ 1
    n
    • 2
    • 2
  • m

    Michael Roberts

    06/09/2022, 8:19 AM
    Hey all - just a quick question, I’m seeing a warning “Preview feature “dataproxy” is deprecated. The functionality can be used without specifying it as a preview feature.” - are we ok to remove the dataproxy item from the previewFeatures list in our schema defintion file? Do we need to do anything else?
    👀 1
    n
    • 2
    • 5
  • u

    user

    06/09/2022, 9:32 AM
    👉 Prisma Day 2022 --

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

    --
    🙌 2
    👀 2
    prisma rainbow 4
    n
    • 1
    • 1
  • m

    Mike Härtl

    06/09/2022, 1:15 PM
    Hi everyone. Doing my first steps with prisma and wonder if something like this MySQL type definition is supported in prisma schemas:
    Copy code
    `updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    I found
    @default(now())
    but struggle with the
    ON UPDATE CURRENT_TIMESTAMP
    ✅ 1
    n
    • 2
    • 3
  • z

    ZB

    06/09/2022, 1:19 PM
    Hello everybody :). I've been having fun using prisma for my personal projects, the best ORM I've used by far. I was wondering if I could shadow an experienced engineer and see prisma in action at scale? I'm still early in my journey and career and just want to understand deeply and continue to shape my understanding through those who have more experience and wisdom. Feel free to message me here on Slack. Peace and much love, ZB
    ✅ 1
    n
    • 2
    • 1
  • b

    Bruno Orosco

    06/09/2022, 7:26 PM
    hi everybody! I have a problem regarding a relationship section, I need to compose a product through other products. And the prism generates error of: 'Error validating model "CompProduct": Wrongly named relation detected. The fields
    ProductPrinciple
    and
    ProductSecundary
    in model
    CompProduct
    both use the same relation name. Please provide different relation names for them through `@relation(<name>).' model Product { prod_id String @id @default(uuid()) @db.VarChar(100) description String @db.VarChar(100) idParceiro String price Decimal @db.Decimal(10, 2) status Status @default(active) //se esta ativo ou inativo createdAt DateTime @default(now()) updatedAt DateTime @updatedAt CompProduct _CompProduct_[] @@map("product") } model CompProduct { comp_prpduct_id String @id @default(uuid()) @db.VarChar(100) prod_principle_id String @db.VarChar(100) prod_comp_id String @db.VarChar(100) //relacionamento ProductPrinciple Product @relation("prod_id", _fields_: [prod_principle_id], _references_: [prod_id]) ProductSecundary Product @relation("prod_id", _fields_: [prod_comp_id], _references_: [prod_id]) Product Product? @relation(_fields_: [productProd_id], _references_: [prod_id]) productProd_id String? @db.VarChar(100) @@map("comp_product") }
    ✅ 1
    r
    • 2
    • 12
  • b

    Bruno Orosco

    06/09/2022, 7:27 PM
    thank's
  • g

    Gelo

    06/09/2022, 7:28 PM
    How to insert_many using mongodb and ignore duplicate? does prisma has "ordered" property?
    ✅ 1
    a
    • 2
    • 1
  • u

    Usman Sabuwala

    06/10/2022, 1:25 AM
    👋 Hello, team!
    👋 1
    👀 1
    a
    • 2
    • 1
  • u

    Usman Sabuwala

    06/10/2022, 1:25 AM
    I needed some help
  • j

    Jeff

    06/10/2022, 2:28 AM
    Hey Prisma 👋 I've had a great experience with using Prisma up until this morning -- ran into a tricky problem.
  • j

    Jeff

    06/10/2022, 2:30 AM
    I'm connecting to a planetscale database within my deployed Vercel app. I am able to read/write to it perfectly fine on localhost but as of this morning I am getting spotty connection errors on my production build, which appear to be at random
  • j

    Jeff

    06/10/2022, 2:31 AM
1...584585586...637Latest