https://www.prisma.io/ logo
Join Slack
Powered by
# random
  • a

    Aleks Stepančič

    07/16/2022, 1:32 PM
    is it possible to convert dbml into prisma scheme?
    ✅ 1
    n
    • 2
    • 1
  • o

    Omar

    07/17/2022, 5:42 PM
    Hey all, I've built a new Prisma Generator to emit custom models based on Prisma recommendations(as mentioned in the docs). Currently, you could either
    WRAP
    or
    EXTEND
    . More grouping behaviors will be added soon. Feel free to try it here: https://github.com/omar-dulaimi/prisma-custom-models-generator
    👍 1
  • j

    Jannis Milz

    07/17/2022, 8:17 PM
    Is there a way to create a dynamic schema.prisma? Like I want to choose e.g. the provider based on the user input. Is that possible?
    ✅ 1
    o
    • 2
    • 3
  • r

    Roland Sankara

    07/19/2022, 5:41 PM
    Hi everyone. I recently created a simple REST API (using Express, Prisma and PostgreSQL) which works fine. Am now currently trying to write some unit tests but am wondering how I can create a test environment with it's own test database. Is it possible to programmatically change the DATABASE_URL in the
    schema.prisma
    file? For example: Given DEVELOPMENT, TEST, PRODUCTION environments, I would maybe create this kind of logic;
    Copy code
    const { DEVELOPMENT, PRODUCTION, LOCAL } = require("./envTypes");
    let DB_URL;
    switch (process.env.NODE_ENV) 
    {  case DEVELOPMENT:    
         DB_URL = process.env.DB_URL_DEV;    
          break;  
       case PRODUCTION:    
         DB_URL = process.env.DB_URL_PROD;    
         break;   
       case LOCAL:    
         DB_URL = process.env.DB_URL_LOC;    
         break;  
       default:    
          DB_URL = process.env.DB_URL;
    }
    s
    • 2
    • 9
  • k

    kuksik

    07/20/2022, 11:34 AM
    Hi, everyone. I want created new table and migrate data from another one. I want to do it using custom migration. In the schema
    id
    described as
    cuid
    . Database - postgres. My question: how i can set
    cuid
    in the custom migration? Or i should do it in another way?
    ✅ 1
    n
    • 2
    • 4
  • w

    Will

    07/20/2022, 3:54 PM
    In mysql, does Prisma use still use separate queries instead of table joins? Performance was terrible.
    👀 1
    n
    • 2
    • 1
  • j

    Jayek

    07/20/2022, 8:36 PM
    How I can organize prisma to use single
    .env
    defined in root directory of my repository where prisma is located in
    packages/prisma-db
    . I struggling with this monorepo hell for hours now.
    ✅ 1
    • 1
    • 1
  • m

    Michael Jay

    07/22/2022, 12:47 PM
    This morning, I realized that I was experiencing some serious discomfort at my workstation. Upon a checkdown, I realized that it was the searing white light of Prisma Studio. So, with high hopes, I go into settings. YES! Dark mode! My eyes are saved! 👀 😍
    😂 1
    prisma rainbow 6
  • g

    Gaurav Sharan

    07/25/2022, 11:35 AM
    https://discord.gg/SXYE4Z6REg
  • i

    Ibu Madha

    07/26/2022, 1:58 PM
    Hi everyone! I’m curious what everyone’s caching strategy is - do you cache at the DB layer, application layer after getting stuff from Prisma on clients, etc? What kind of tooling are you using, if any?
    ✅ 1
    n
    n
    • 3
    • 3
  • o

    Oskar

    07/27/2022, 11:04 AM
    Hello, when you do
    prisma.post.findMany()
    when used with PostgreSQL it'll search for
    <http://public.post|public.post>
    table. But in my case I have a different SQL schema. Where can I define this? I already added
    ?schema=myschema
    to the
    DATABASE_URL
    and
    prisma db pull
    works fine for my custom schema.
    n
    • 2
    • 4
  • s

    Sai Krishna

    08/03/2022, 9:25 AM
    Hello all Superblog is a balzing-fast and SEO focused blogging platform built with Prisma. It is ten-years of my SEO+Tech journey converted into a blogging platform. Finally, launched Superblog on ProductHunt! Your support will be really helpful 🙂 Please take a look at the post here: https://www.producthunt.com/posts/superblog-2 Thank you so much!
    ⬆️ 2
    👏🏾 1
    🙌🏾 1
    🙌 2
    👏 3
    prisma rainbow 3
  • k

    KIM SEI HOON

    08/05/2022, 5:27 AM
    Hello, I am trying to use Prisma Client by custom output, but there is a problem. Inside the output prisma, the
    .node
    engine file and
    schema.prisma
    file exists, but when built,
    .node, schema.prisma
    There is no prisma file and an error occurs during deployment. Does anyone have the same symptoms as me? Or is there any action needed to resolve this issue? Thank you! my develop info prisma ver: 4.1.1 prisma client 4.1.1 database: postgres SQL yarn workspace v1
    v
    • 2
    • 1
  • m

    Michael Jay

    08/05/2022, 7:22 PM
    Here's a crazy question. We know that Prisma can be used for SQL or MongoDB. Is there any way that an ORM/ODM could be expanded to work with some of the cloud databases - Firestore, Dynamo, .... whatever Azure's is. That would be too slick.
    ✅ 1
    c
    n
    m
    • 4
    • 3
  • a

    Alex Vilchis

    08/06/2022, 9:39 PM
    Like this issue, guys! https://github.com/apollographql/apollo-client/issues/9948
    👍 1
  • a

    Adônis Uessler

    08/07/2022, 10:05 PM
    Hi guys, can help me ? rs I creating an function with serverless and using serverless-esbuild, but ever when I try to run locally or deploy this function I receive this error : " ENOENT: no such file or directory, open '...node_modules\.prisma\client\schema.prisma'" I read about this in other forums, but not has succesfully to resolve, I know this is something related to bundler that i used, but how can I resolve this ? I trying resolve this for 10 days and for be honest I dont know more where I can search help for this... (I will need jump to the darkweeb of google ?! PAGE 2 rsrsr)
    👀 1
    n
    • 2
    • 2
  • j

    Jaksa Malisic

    08/08/2022, 12:42 PM
    Hi people, is there a way to get
    PrismaClient
    generic types without generating client itself? By “generic types” I mean the type of prisma.<anything>.<I’m trying to access type of this>, example:
    Copy code
    const count = await prisma[camelCase(options.name)].count(params);
    The catch here is that I can’t generate the client because I’m writing a backend library, so basically client gets generated in consumption context (a microservice) and I don’t need any of entity specific stuff, since my specific usecase is to build a very generic crud system
    a
    • 2
    • 1
  • d

    Deepak Guptha S

    08/10/2022, 9:47 AM
    👋 Hello, I don't know how to perform bulk insertion, updation or deletion in Prisma for
    GoLang
    Or how to perform transaction for multiple records (insertion, updation or deletion) using
    executeRaw
    Is there any examples or documentation link ?
    👀 2
    ✅ 1
    r
    • 2
    • 1
  • j

    Jeffr

    08/11/2022, 8:11 AM
    sss
  • t

    Taras Protchenko

    08/11/2022, 10:09 AM
    Hello, check out my new blog post about React micro frontends and Dynamic Module Federation - https://taras.one/blog/dynamic-micro-frontends-with-nx-and-react
    🙌🏾 1
    🙌 3
  • q

    Quentin Gilon

    08/12/2022, 3:52 PM
    any Prisma3 expert looking for a short job?
    j
    • 2
    • 1
  • v

    Victor Lombardi

    08/12/2022, 4:20 PM
    Hey everyone, maybe someone can help me. How can I use pagination with Prisma in GraphQL ? Does anyone has any idea/package to use?
    👀 1
    r
    • 2
    • 1
  • a

    Adam

    08/12/2022, 6:01 PM
    Question: How does Prisma make money? Who is supporting the development on this tool?
    l
    v
    • 3
    • 2
  • r

    Richard

    08/14/2022, 11:39 AM
    Does anyone know if there's a Slack app that truncates messages in a channel and automatically opens a thread where it adds the remaining message?
    n
    • 2
    • 1
  • g

    Gustavo

    08/23/2022, 9:58 AM
    yeah, TS will try to infer the properties and types of them, based on what's been declared by the user (meaning you). in your example,
    args
    seems to be an object, and you're trying to access the property
    where
    and the property
    id
    from
    where
    which seems to be another object. For this then you would need to declare the type at the parameter level so that TS knows what to expect when you want to use
    args
    e.g. type declaration in line:
    Copy code
    .... = async ({  args: { where: { id: number } }  }) => {
    ...
    }
    Or:
    Copy code
    type MyWhere = {
       id: number;
    };
    
    type MyArgs = {
       where: MyWhere;
    };
    
    .... = async ({  args: MyArgs }  }) => {
    ...
    }
    hope it makes sense 🙂 I'd highly suggest to take on a TS course, this is interactive one: https://www.codecademy.com/learn/learn-typescript
    j
    • 2
    • 3
  • r

    Rohan Rajpal

    08/23/2022, 12:06 PM
    Hey, is there an easy way of doing an update
    only if
    a record exists? Currently I have to first check if it exists & then update, can we do it in one query with prisma? One option is ofcourse try-catch but was curious if some better method exists
    i
    n
    c
    • 4
    • 9
  • s

    Songkeys

    08/24/2022, 1:35 AM
    I found this…. https://github.com/prisma/docs/pull/3610
    n
    • 2
    • 2
  • n

    Nurul

    08/26/2022, 6:18 AM
    Could you share the schema file and query here in text format? It’s difficult to copy it from the screenshot. 😅
    a
    • 2
    • 12
  • m

    Moheb Dabilkar

    08/26/2022, 5:41 PM
    Hey, I have 2 schemas for 2 microservices one with user, admin and owner data with address other with orders data which contains the address i dont want to have 2 tables for address i.e one in 1st service and other in second i can take address from users microservice to orders but cant seem to figure this without duplication in orders address is there any way to solve this
    👀 1
    a
    v
    • 3
    • 2
  • m

    Moheb Dabilkar

    08/26/2022, 5:48 PM
    User service:
    Copy code
    generator client {
      provider = "prisma-client-js"
    }
    
    datasource db {
      provider = "postgresql"
      url      = env("DATABASE_URL")
    }
    
    model User {
      id          Int       @id @default(autoincrement())
      email       String    @unique
      firstName   String
      lastName    String?
      birthDate   DateTime
      phoneNumber Int       @unique
      verified    Boolean   @default(false)
      address     Address[]
      password    String    @default("None")
      createdAt   DateTime  @default(now())
      updatedAt   DateTime  @updatedAt
    }
    
    model Owner {
      id           Int       @id @default(autoincrement())
      email        String    @unique
      firstName    String
      lastName     String?
      birthDate    DateTime
      phoneNumber  Int       @unique
      verified     Boolean   @default(false)
      address      Address[]
      restaurantId Int[]
      createdAt    DateTime  @default(now())
      updatedAt    DateTime  @updatedAt
    }
    
    model Admin {
      id          Int       @id @default(autoincrement())
      email       String    @unique
      firstName   String
      lastName    String?
      birthDate   DateTime
      phoneNumber Int       @unique
      verified    Boolean   @default(false)
      address     Address[]
      createdAt   DateTime  @default(now())
      updatedAt   DateTime  @updatedAt
    }
    
    model Address {
      id      Int         @id @default(autoincrement())
      User    User?       @relation(fields: [userId], references: [id])
      userId  Int?
      line1   String
      line2   String
      area    String
      city    String
      type    AddressType @default(HOME)
      Owner   Owner?      @relation(fields: [ownerId], references: [id])
      ownerId Int?
      Admin   Admin?      @relation(fields: [adminId], references: [id])
      adminId Int?
    }
    
    enum AddressType {
      HOME
      OFFICE
      OTHER
    }
    Order Service:
    Copy code
    generator client {
        provider = "prisma-client-js"
    }
    
    datasource db {
        provider = "postgresql"
        url      = env("DATABASE_URL")
    }
    
    model Order {
        id                 Int          @id @default(autoincrement())
        user               Int
        rider              Int?
        restaurant         Restaurant   @relation(fields: [restaurantId], references: [id])
        restaurantId       Int
        orderPickedTime    DateTime?
        orderDeliveredTime DateTime?
        total              Int
        deliveryFee        Int
        couponDiscount     Int
        finalTotal         Int
        dishes             Dishes[]
        orderStatus        ORDER_STATUS @default(CREATED)
        address            Address      @relation(fields: [addressId], references: [id])
        addressId          Int
        createdAt          DateTime     @default(now())
        updatedAt          DateTime     @updatedAt
    }
    
    model Address {
        id           Int          @id @default(autoincrement())
        line1        String
        line2        String
        area         String
        city         String
        userId       Int[]
        order        Order[]
        Restaurant   Restaurant?  @relation(fields: [restaurantId], references: [id])
        restaurantId Int?         @unique
        type         ADDRESS_TYPE @default(HOME)
        createdAt    DateTime     @default(now())
        updatedAt    DateTime     @updatedAt
    }
    
    model Restaurant {
        id               Int            @id @default(autoincrement())
        name             String
        vegOnly          Boolean        @default(false)
        ownerId          Int
        dishes           Dishes[]
        address          Address?
        restaurantStatus CURRENT_STATUS @default(OFFLINE)
        createdAt        DateTime       @default(now())
        updatedAt        DateTime       @updatedAt
        Order            Order[]
    }
    
    model Dishes {
        id           Int        @id @default(autoincrement())
        name         String
        veg          Boolean    @default(false)
        glutenFree   Boolean    @default(false)
        order        Order[]
        category     category[]
        restaurant   Restaurant @relation(fields: [restaurantId], references: [id])
        restaurantId Int
        cost         Int
        createdAt    DateTime   @default(now())
        updatedAt    DateTime   @updatedAt
    }
    
    model category {
        id        Int      @id @default(autoincrement())
        name      String   @unique
        dishes    Dishes[]
        createdAt DateTime @default(now())
        updatedAt DateTime @updatedAt
    }
    
    enum ORDER_STATUS {
        CREATED
        PICKEDUP
        DELIVERED
        CANCELLED
    }
    
    enum DISH_STATUS {
        AVAILABLE
        UNAVAILABLE
    }
    
    enum CURRENT_STATUS {
        OFFLINE
        ONLINE
    }
    
    enum ADDRESS_TYPE {
        HOME
        OFFICE
        RESTAURANT
        OTHER
    }
1...4950515253Latest