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

    Misan

    06/23/2022, 10:54 AM
    Hey there. I am building software that does not run centrally on one server, but on multiple servers with their own database. This is why I cannot deploy changes as part of a CI pipeline. What is the recommended way then to migrate a database? Do I run
    npx prisma migrate deploy
    on that machine when updating the piece of software? What can I do to avoid conflicts?
    ✅ 1
    s
    • 2
    • 1
  • m

    Michael Gates

    06/23/2022, 12:18 PM
    I am trying to use Prisma with yarn v3.2.1 with PnP and whenever I run
    prisma migrate
    , it always defaults to using NPM instead of Yarn, which causes
    node_modules
    to be created and the prisma client to be generated in there, rather than the path I gave it in the
    schema.prisma
    client output.
    👀 1
    a
    • 2
    • 1
  • u

    user

    06/23/2022, 12:49 PM
    👉 Adventures in type safe Prisma clients - Josh Goldberg I Prisma Day 2022 --

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

    -- This talk was recorded on #prismaday | June 16th, 2022. Prisma Day is a community-focused hybrid conference on modern application development and databases. Prisma generates fantastic TypeScript types for clients. They include type system features such as conditional and mapped types to give precise types for the results of client method calls. This talk will cover how those foundational types work in TypeScript and the ways Prisma uses them. We'll also cover how to use them to extend Prisma's types for wrapper functions and other shenanigans I've seen consumers of Prisma need. Josh is an open-source developer from New York with a passion for accessibility and static analysis. He works in the TypeScript ecosystem and published a Learning TypeScript book with O'Reilly. Connect with Josh: https://twitter.com/JoshuaKGoldberg
    prisma rainbow 1
  • u

    user

    06/23/2022, 12:49 PM
    👉 Serverless heaven - Hassan Bazzi I Prisma Day 2022 --

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

    -- This talk was recorded on #prismaday | June 16th, 2022. Prisma Day is a community-focused hybrid conference on modern application development and databases. Together, we will dive into how we've used serverless technologies at Nuna to scale infinitely. We use the power of Prisma Data Proxy to talk to our serverless MongoDB database through our serverless NextJS API. And if our small team can do it, so can you! Hassan is a people-oriented engineering leader. He builds teams with a core DNA of compassion and autonomy and loves to code in all parts of the stack. Passionate about space, nature, and philosophy. Connect with Hassan: https://twitter.com/habazzi
    prisma rainbow 1
  • u

    user

    06/23/2022, 12:49 PM
    👉 Using Prisma to connect any Canadian household to the Internet - Olivier Falardeau I Prisma Day 2022 --

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

    -- This talk was recorded on #prismaday | June 16th, 2022. Prisma Day is a community-focused hybrid conference on modern application development and databases. The fixed-line Internet landscape in Canada is... not optimal. Competition is scarce, prices are high for average speeds, and the NPS score in the industry is embarrassing. Now, what if I told you that modern web technologies, like GraphQL, Prisma, TypeScript, and a handful of developers can be a game-changer in this dreaded sector? Oli is a full-stack developer from Quebec with a passion for distributed systems and trading. He worked in machine learning at Rakuten and is now focused on building legendary engineering teams. Connect with Oli: https://www.linkedin.com/in/olivier-falardeau-5513139b/
    prisma rainbow 1
  • g

    Ghimsim Chua

    06/23/2022, 4:09 PM
    Hi Prisma, I am a Product Manager with TiDB. We are interested in integrating our database into Prisma’s ecosystem. Can I please talk to someone about how to get this started? Thanks!
    👀 1
    v
    • 2
    • 1
  • u

    user

    06/23/2022, 4:56 PM
    👉 How we make Prisma Docs effective and engaging - Lucy Keer & Nilufar Bava I Prisma Day 2022 --

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

    -- This talk was recorded on #prismaday | June 16th, 2022. Prisma Day is a community-focused hybrid conference on modern application development and databases. When Prisma releases new features, how do we make sure everyone can learn about them? In this talk, we’ll cover how Prisma’s docs and website teams work together with developers and the community to create our documentation. Nilufar is a web developer with over a decade of experience in several web, native and hybrid frameworks. She has been leading the web development in Prisma for the past couple of years. Connect with Nilu: https://twitter.com/nilubava Lucy is a technical writer at Prisma. She previously worked as a software developer and enjoys combining these skills to find ways to explain technical topics clearly. Connect with Lucy: https://twitter.com/drossbucket
    prisma rainbow 1
  • u

    user

    06/23/2022, 4:56 PM
    👉 Things about Prisma VSCode extension that just make sense - Alberto Schiabel I Prisma Day 2022 --

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

    -- This talk was recorded on #prismaday | June 16th, 2022. Prisma Day is a community-focused hybrid conference on modern application development and databases. The Prisma extension for VSCode is a foundational pillar of the Prisma ecosystem, though it has undergone a lot of improvements during the past year. In this talk, we'll touch on the major architectural refactorings that ultimately led to a better developer experience: from adopting WASM to supporting the editor-agnostic Language Server Protocol. Alberto is a senior software engineer and former startup co-founder. He has 7+ years of experience, and he's into typed functional programming. He's currently a part of the Schema Team at Prisma. Connect with Alberto: https://twitter.com/jkomyno
    prisma rainbow 1
  • u

    user

    06/23/2022, 4:58 PM
    👉 How Redwood and Prisma make frontend developers fullstack - Amy Dutton I Prisma Day 2022 --

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

    -- This talk was recorded on #prismaday | June 16th, 2022. Prisma Day is a community-focused hybrid conference on modern application development and databases. Backend technology is often elusive and an obstacle for frontend developers. The strategic pairing (Frontend to Fullstack), however, is where the magic happens. A solid backend makes the frontend “smart” and truly shine. Tooling, like Redwood and Prisma, helps developers leverage full-stack capabilities, allowing teams to build faster and more efficiently, connecting critical front and backend user experiences. “How to go Frontend to Fullstack with Redwood and Prisma” will demonstrate how critical backend technologies are approachable and easy to learn, even for frontend engineers. Developers knowledgeable in JavaScript already have everything they need to be successful. It’s simply a matter of putting the pieces together by leveraging the right tech and platform combinations. In preparation for this talk, I will create a demo with all the frontend code needed for a full-stack, web application. I will demonstrate how easy it is to build out the project and connect the backend layer, using tools like Redwood and Prisma. Amy loves using her 20 years of internet experience to teach developers how to design and designers how to develop. She lives in Nashville, TN, USA, with her husband, 3 adorable kids, and 2 dogs. Connect with Amy: https://twitter.com/selfteachme
    prisma rainbow 1
  • u

    user

    06/23/2022, 5:33 PM
    👉 Prisma Meetup: CockroachDB Edition + a raffle! 🎁 --

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

    -- Prisma Online Meetup #8 is coming up! 🤓 This time we are joining forces with CockroachDB for insights on how to seamlessly integrate the two technologies. Our superstar lineup: ◭ Sid Dange - CockroachDB with Prisma at Vista ◭ Sabin Adams, Aydrian Howards - Distributed data and powerful tooling with Prisma & CockroachDB 🎁 During this event, we will host a raffle, where you can win a copy of the "CockroachDB: The Definitive Guide" book. 🎁
    prisma rainbow 1
  • j

    JC

    06/23/2022, 6:34 PM
    Anyone have any issues upgrading from 3.14.0 -> 3.15.2? It seems to cause my node/express app to crash without any real errors
    ✅ 1
    a
    • 2
    • 3
  • m

    Matias

    06/23/2022, 8:03 PM
    Hi. What is the "applied" column in the Migration table? (prisma database). I see different numbers and I would like to know what it means
    s
    • 2
    • 1
  • j

    Joe McKenney

    06/23/2022, 8:42 PM
    👋 - I wanted to highlight some issues we are running into as part of the upgrade from prisma@3.14.0 => prisma@3.15.2. The prisma client generation has started to produce a
    package.json
    file which seems to breaks various assumptions of package managers (e.g. https://github.com/prisma/prisma/issues/13893, https://github.com/yarnpkg/berry/issues/4572). The latter is an issue I just filed on yarn but it is worth highlighting how it relates to the prisma change. For us, we have a polyglot monorepo that utilizes yarn workspaces. We also have 3 databases, all of which we configure and access with Prisma. Accordingly, we generate multiple prisma clients in one monorepo (with more to come as we add additional services/apps). We utilize the client generation output configuration to plop the generated client into the
    ./dist
    of appropriately named and located package e.g.
    @{company-name}/users-service-orm
    (effectively wrapping it in our own package and tracking it as part of our package dependency graph). As a rule, all of our package build artifacts (
    ./dist
    dirs for TS packages in our monorepo) are gitignored in our top-level
    .gitignore
    as well as package-specific `.gitignore`s. We agree with y'all that build artifacts shouldn't end up in version control. The
    package.json
    that ends up in client package's
    ./dist
    dir are getting picked up by yarn workspaces 😞 e.g. yarn workspace globbing doesn't respect gitignored files/dirs. That is very much a yarn problem but it does feel like the change to produce
    package.json
    files as part of client generation relies heavily on the assumption that you will put the generated SDK into node modules. I've read your docs on this matter and understand the reasoning but would also argue that it is not necessarily the most natural solution in all cases (e.g. a large polyglot monorepo). One idea/proposal - would you consider configuration for the client generation that would allow us to avoid creating a package.json, equivalent to saying that we will manage these build artifacts ourselves? Open to other ideas as well.
    👀 1
    ➕ 2
    a
    • 2
    • 3
  • u

    ut dev

    06/23/2022, 10:08 PM
    Hi guys I have following Prisma schema:
    model Snippet {
    id           String      @id @default(uuid())
    title        String
    user         _User_        @relation(fields: [_userId_], references: [_id_])
    userId       String
    technology   _Technology_  @relation(fields: [_technologyId_], references: [_id_])
    technologyId String
    createdAt    DateTime    @default(now())
    updatedAt    DateTime    @updatedAt
    tags         _Tag_[]
    Visibility   _Visibility_? @relation(fields: [_visibilityId_], references: [_id_])
    visibilityId String?
    }
    model Tag {
    id        String   @id @default(uuid())
    name      String
    createdAt DateTime @default(now())
    updatedAt DateTime @updatedAt
    Snippet   _Snippet_? @relation(fields: [_snippetId_], references: [_id_])
    snippetId String?
    }
    Running
    pnpm prisma migrate dev
    To update my schema does not add the tags field to my snippet model, what am I missing? Am I creating wrong relation using that syntax, basically a Snippet should be able to contain multiple Tags.
    s
    • 2
    • 5
  • u

    user

    06/24/2022, 10:51 AM
    👉 Pothos + Prisma: delightful, type-safe and efficient GraphQL - Michael Hayes I Prisma Day 2022 --

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

    -- This talk was recorded on #prismaday | June 16th, 2022. Prisma Day is a community-focused hybrid conference on modern application development and databases. Learn how Pothos and Prisma can create a delightful developer experience for building type-safe GraphQL APIs with great performance and type safety without sacrificing flexibility and control over your API or closely coupling your API to your database schema. Michael is a developer with a passion for developer tools. He has worked on tracing at New Relic, node infrastructure at Airbnb, and is now focusing on open source tooling for type-safe GraphQL. Connect with Michael: https://twitter.com/yavascript
    prisma rainbow 1
  • u

    user

    06/24/2022, 10:51 AM
    👉 Developer-owned databases: a new frontier? - Liz van Dijk I Prisma Day 2022 --

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

    -- This talk was recorded on #prismaday | June 16th, 2022. Prisma Day is a community-focused hybrid conference on modern application development and databases. Developers don't always tend to have the healthiest relationship with their databases. Design choices that, early on, can feel unimportant tend to grow into monstrous scalability challenges down the line, and entire families of technologies have sprung up around the ability to avoid ever having to make changes to an old, inefficiently designed schema. But why do we keep falling into the same traps, and how can we avoid them? This talk will cover some of the key points to pay attention to in early relational database design, share some war stories around scaling up, and arm you with the knowledge and tools to design a database that will scale along with your application's success. Liz has been active as a consultant and solution architect in the MySQL Scalability world for the past decade. Connect with Liz: https://twitter.com/lizztheblizz
    prisma rainbow 1
  • u

    user

    06/24/2022, 10:51 AM
    👉 Introducing Neon - Nikita Shamgunov I Prisma Day 2022 --

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

    -- This talk was recorded on #prismaday | June 16th, 2022. Prisma Day is a community-focused hybrid conference on modern application development and databases. Databases are foundational machinery in modern society. Mission-critical applications are built on Postgres, and the Postgres community continues to strengthen Postgres to meet real-world demands. We believe Postgres will remain one of the most important (open-source) relational databases of our time. Neon is a serverless implementation of PostgreSQL. It’s an auto-scaling, on-demand database as a service for modern applications, making it a credible open-source alternative to Amazon Aurora. Neon’s key innovation is a separation of storage and computation which makes Postgres cloud-native and serverless. This allows for several advantages: Neon reduces the complexity involved in provisioning and managing database capacity and scales up to support large databases or scales down when the database is not needed. Additionally, it allows efficient management of database resources. Nikita is a Founder of Neon - serverless Postgres. Nikita also is a Partner at Khosla Ventures. He is passionate about deep tech, data infrastructure, and system software. Connect with Nikita: https://twitter.com/NikitaShamgunov
    prisma rainbow 1
  • n

    Nigel Greenway

    06/24/2022, 11:13 AM
    Hi, I was wondering if there is a favoured node image for running Prisma? Or a list of dependencies I can look at?
    👀 1
    ✅ 1
    a
    • 2
    • 11
  • u

    user

    06/24/2022, 12:06 PM
    👉 A Glimpse into the Future of Prisma - Nikolas Burk I Prisma Day 2022 --

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

    -- In this talk, Nikolas gives an overview of the features that the Prisma team is planning to work on over the next 3-6 months. It was recorded on #prismaday | June 16th, 2022. 00:00 Intro 02:14 Priorities for 2022 04:03 Metrics 09:39 Query Analytics 14:13 Multi-Schema Querying 19:14 Prisma Client Extensions 26:50 Closing remarks Nikolas is passionate about teaching and sharing knowledge. He has been with Prisma since the early days and loves to connect with the Prisma community! Prisma Day is a community-focused hybrid conference on modern application development and databases. Prisma has seen rapid adoption in the developer community! We are excited about this and want to continue building world-class developer tools that make it easier for developers to work with databases. In this talk, you will see what kind of features we have on the roadmap for 2022 and beyond. Connect with Nikolas: https://twitter.com/nikolasburk
    prisma rainbow 1
  • u

    user

    06/24/2022, 12:06 PM
    👉 SQL tricks and concepts you didn't know about - Aleksandra Sikora I Prisma Day 2022 --

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

    -- This talk was recorded on #prismaday | June 16th, 2022. Prisma Day is a community-focused hybrid conference on modern application development and databases. Did you know that some SQL variants are Turing complete and let you write any program in SQL? Of course, no one's that crazy... But what are the limits of SQL? What are some crazy things we can do with it? I'm going to go over a few of them in this talk. It won't be only fun stuff, though! I'm going to show some more practical but lesser-known concepts too. Let's discover some hidden SQL traits together! Aleksandra is a software engineer based in Wrocław, Poland. She's worked as a full-stack developer with many different languages such as Elixir, Golang, Python, and TypeScript. She was previously a tech lead for the Hasura Console, and now she's a lead maintainer of Blitz.js. Connect with Aleksandra: https://twitter.com/aleksandrasays
  • u

    ut dev

    06/24/2022, 8:52 PM
    Hi guys I have following setup
    model Snippet {
    id           String      @id @default(uuid())
    title        String
    user         _User_        @relation(fields: [_userId_], references: [_id_])
    userId       String
    technology   _Technology_  @relation(fields: [_technologyId_], references: [_id_])
    technologyId String
    createdAt    DateTime    @default(now())
    updatedAt    DateTime    @updatedAt
    Visibility   _Visibility_? @relation(fields: [_visibilityId_], references: [_id_])
    visibilityId String?
    Tag          _Tag_[]
    }
    model Tag {
    id        String   @id @default(uuid())
    name      String
    createdAt DateTime @default(now())
    updatedAt DateTime @updatedAt
    Snippet   _Snippet_? @relation(fields: [_snippetId_], references: [_id_])
    snippetId String?
    }
    Running the migration afterwards like
    pnpm prisma migrate dev
    Gives me following error: Error: P3006 Migration
    20220623223220_update_relation_for_snippet_and_tags
    failed to apply cleanly to the shadow database. Error:
    db error: ERROR: foreign key constraint "Snippet_tagId_fkey" cannot be implemented
    DETAIL: Key columns "tagId" and "id" are of incompatible types: text[] and text.
    0: sql_migration_connector::validate_migrations
    at migration-engine/connectors/sql-migration-connector/src/lib.rs:272
    1: migration_core::state::DevDiagnostic
    at migration-engine/core/src/state.rs:250
  • n

    Nigel Greenway

    06/24/2022, 9:59 PM
    Is it possible to have multiple schema files in the prisma directory? From what I'm reading, it's possible but I need to reference it in the
    prisma generate
    call?
    ✅ 1
    👀 1
    s
    • 2
    • 5
  • k

    Kay Khan

    06/25/2022, 3:51 PM
    Does @updatedAt work in postgres?
    Copy code
    model users {
        id         String    @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
        email      String
        password   String?
        created_at DateTime  @default(now())
        updated_at DateTime  @updatedAt
        deleted_at DateTime?
    }
    if i create a new user, updated_at is not autofilled generated sql
    Copy code
    CREATE TABLE "users" (
        "id" UUID NOT NULL DEFAULT gen_random_uuid(),
        "email" TEXT NOT NULL,
        "password" TEXT,
        "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
        "updated_at" TIMESTAMP(3) NOT NULL,
        "deleted_at" TIMESTAMP(3),
    
        CONSTRAINT "users_pkey" PRIMARY KEY ("id")
    );
    ✅ 1
    a
    • 2
    • 2
  • m

    Michael Plaxico

    06/25/2022, 5:50 PM
    G’day, folks. I’m noticing that, when I run
    findUnique
    and no records match my query, I get an internal server error. I can’t even prevent this from happening by specifying
    rejectOnNotFound: false
    . It happens to matter what.
    Copy code
    Invalid `prisma.product.delete()` invocation:
    
    
      An operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.
    Error:
    Invalid `prisma.product.delete()` invocation:
    
    
      An operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.
        at RequestHandler.request (/Users/meh/codebase/blah/blah-api/node_modules/@prisma/client/runtime/index.js:49022:15)
        at PrismaService._request (/Users/meh/codebase/blah/blah-api/node_modules/@prisma/client/runtime/index.js:49919:18)
        at ProductsService.deleteProduct (/Users/meh/codebase/blah/blah-api/src/products/products.service.ts:27:12)
        at ProductsResolver.deleteProduct (/Users/meh/codebase/blah/blah-api/src/products/products.resolver.ts:45:12)
        at target (/Users/meh/codebase/blah/blah-api/node_modules/@nestjs/core/helpers/external-context-creator.js:77:28)
        at /Users/meh/codebase/blah/blah-api/node_modules/@nestjs/core/helpers/external-proxy.js:9:24
    ✅ 1
    t
    • 2
    • 3
  • j

    joao.santos

    06/25/2022, 7:54 PM
    Hey guys how can i search between iso dates?
    Copy code
    dataini: {  equals: "2006-01-23T19:00:00.000Z" }
    if I do this it works but if I want only to specify a date like this 2006-01-23 it doesnt return nothing....
    ✅ 1
    t
    • 2
    • 4
  • a

    akku

    06/26/2022, 7:34 AM
    Hi, I’m implementing an account system whereby a user creates an invite ticket to invite another, and then the latter is marked as having been invited by the original user’s ID. I’m struggling to understand how I can create a relation between instances of the same model.
    ✅ 1
  • a

    akku

    06/26/2022, 7:34 AM
    This is what I have so far
  • a

    akku

    06/26/2022, 8:03 AM
    Oh nevermind, I found the docs article explaining self-relations, not sure how I missed it
    💯 1
  • t

    Takeo Kusama

    06/26/2022, 10:01 AM
    Hi, I use prisma postgres date db type. Can this set date record base on local timezone date. My timezone UTC+9:00, so in my client nodejs,
    prisma.some_table.create({ date_column: new Date(2021,9,1) })
    may interpret 2021-08-31T150000.000Z as UTC to 2021-08-31T000000.000Z so, the result it saves 2021-08-31 as the date. It is ideal if prisma orm accept date.toLocaleString() as date type record value, but it doesn’t. For codebase clean as possible, I don’t want to rely on add offset base solutions. Is there any idea?
    ✅ 1
    • 1
    • 1
  • p

    pyjama929

    06/26/2022, 2:02 PM
    Hi everybody, I've been banging my head against the wall for the last hour. I want to implement a simple like system. An user, can like an item which it stores as an entry in the like table. Option 1: create a new record for each like and delete it on unlike Option 2: create a new record for each like and set liked column to true and set it to false on unlike Because userId and itemId are foreign keys in my schema my queries are not working. It seems impossible to use foreignkeys in 'where' for example. But if I can't check if userId and itemId are already in a row I can't check if a like already exist for the user on a certain comment.
    Copy code
    model Likes {
      id          String  @id @default(cuid())
      userId      String
      itemId      String
      liked       Boolean
      createdAt   DateTime @default(now())
      updatedAt   DateTime @default(now())
      user        User    @relation(fields: [userId], references: [id], onDelete: Cascade)
      items       Items   @relation(fields: [itemId], references: [id], onDelete: Cascade)
    }
    
    model Items {
      id          String  @id @default(cuid())
      content     String
      userId      String
      done        Boolean @default(false)
      createdAt   DateTime @default(now())
      updatedAt   DateTime @default(now())
      completedAt DateTime?
      user        User    @relation(fields: [userId], references: [id], onDelete: Cascade)
      comments    Comments[]
      likes       Likes[]
      products    Products[]
    }
    
    model User {
      id            String    @id @default(cuid())
      name          String?   @unique @default(cuid())
      displayName   String?
      location      String?
      bio           String?
      twitter       String?
      email         String?   @unique
      emailVerified DateTime?
      image         String?
      lastOnline    DateTime?
      isAdmin       Boolean @default(false)
      isPremium     Boolean @default(false)
      createdAt     DateTime   @default(now())
      updatedAt     DateTime   @updatedAt
      accounts      Account[]
      sessions      Session[]
      items         Items[]
      comments      Comments[]
      likes         Likes[]
      products     Products[]
    }
    The error I get
    Copy code
    Invalid `prisma.likes.upsert()` invocation:
    {
      where: {
        userId: 'cl3mvrzw00040qj9vsn914xn0'
        ~~~~~~
      },
      create: {
        userId: 'cl3mvrzw00040qj9vsn914xn0',
        itemId: 'cl472xhbd0200va9vtfanjkqv',
        liked: true
      },
      update: {
        liked: true
      }
    }
    
    Unknown arg `userId` in where.userId for type LikesWhereUniqueInput. Did you mean `id`? Available args:
    type LikesWhereUniqueInput {
      id?: String
    }
    👀 1
    a
    v
    • 3
    • 2
1...589590591...637Latest