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

    Paul

    09/03/2021, 2:33 PM
    Hey all. Is Rank supported yet with Prisma? Query
    Copy code
    select id, name, filterType, RANK() OVER (PARTITION BY filterType order by name asc) type_rank from DamFile;
    Result:
    Copy code
    +----------------------------+------------------+------------+-----------+
    | id                         | name             | filterType | type_rank |
    +----------------------------+------------------+------------+-----------+
    | 01FEP11SA9RM3YGQAKTQGKQB2Y | Folder 1         | folder     |         1 |
    | 01FEP0VMFZ88YP495J17SG6SN2 | exif_image1.jpg  | image      |         1 |
    | 01FEP0VMGSF5TN5QK7V15BMYB0 | exif_image10.jpg | image      |         2 |
    Thanks
    r
    • 2
    • 2
  • d

    Daniell

    09/03/2021, 2:47 PM
    What do you guys currently use as alternative to pgBouncer for a SQL database? Started to run into a situation where I have an existing RDS Aurora database and a Next.js application on Vercel 😅
  • r

    Rony Fhebrian

    09/03/2021, 3:30 PM
    hello, can I have “password” dto but “password_salt” in schema? I still gets the error. Thank you
  • p

    Perry Raskin

    09/03/2021, 6:46 PM
    Copy code
    const prisma = new PrismaClient({ log: ["query"] })
      const {
        method,
        query: { id },
        body
      } = req
    
      const userId = id as unknown
      const userIdString = userId as string
      const userIdInt = parseInt(userIdString)
    r
    • 2
    • 4
  • p

    Perry Raskin

    09/03/2021, 6:46 PM
    is there a better way to do this? 😂
  • l

    Logesh Kumar Rajkumar

    09/04/2021, 10:06 AM
    Hi is there any existing solution/workaround for this issue https://github.com/prisma/prisma/issues/6974 I have implemented soft delete functionality using deletedAt column(if deleted adds timestamp). Now I have unique key in the table. I need to add unique index only if deletedAt column is null
    r
    • 2
    • 2
  • d

    Dimitri Ivashchuk

    09/04/2021, 1:03 PM
    Hey! I have a question regarding migration management. I've been tinkering with the database locally and reseted it to apply some migrations. My app consists of self hosted postgres on Digital Ocean + prisma&next running on vercel. Now my production database refuses to migrate due to obvious reasons:
    Copy code
    10:54:13.919  	Error: P3018
    10:54:13.919  	A migration failed to apply. New migrations can not be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: <https://pris.ly/d/migrate-resolve>
    10:54:13.919  	Migration name: 20210904075303_add_new_heats_structure
    10:54:13.919  	Database error code: 23502
    10:54:13.919  	Database error:
    10:54:13.919  	Database error
    10:54:13.919  	Null constraint failed: (property)
    10:54:13.919  	   0: migration_core::api::ApplyMigrations
    10:54:13.919  	             at migration-engine/core/src/api.rs:73
    10:54:13.933  	error Command failed with exit code 1.
    10:54:13.934  	info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.
    10:54:13.950  	Error: Command "yarn run vercel-build" exited with 1
    First question: what would be the correct way to resolve this in two cases: 1. if I care about the data 2. if I don't care if data is lost(this is the case now, but in the future I bet it could be different) Shall I just drop the database and redeploy on vercel? Or there is some prisma magic command that could help me
    r
    • 2
    • 8
  • w

    Wesam Jabali

    09/05/2021, 12:24 AM
    I everyone! Just downloaded Slack to ask one question: I have a model defined in schema.prisma, but when I try to npx generate, it says there isn't one. I'm using Node without any framework, but I ran npx prisma init, getting a good connection to my db etc... just getting this error:
    Copy code
    You don't have any models defined in your schema.prisma, so nothing will be generated.
    You can define a model like this:
  • w

    Wesam Jabali

    09/05/2021, 12:25 AM
    Here is my schema.prisma:
    Copy code
    // Default stuff ... 
    
    model Course {
      id Int @id @default(autoincrement())
      name String
      description String
    }
    r
    • 2
    • 1
  • w

    Wesam Jabali

    09/05/2021, 12:30 AM
    This tool should really have a Discord.
  • u

    user

    09/05/2021, 2:46 PM
    TypeScript Berlin Meetup #7 - Anil Kumar - TypeScript pitfalls to avoid for a great Dev Experience

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

    ◭ In this talk, Anil will demonstrate frustrations and excitement with Typescript during the apps development onboarding for headless CMS and commerce solutions. In addition, he will share three mistakes to avoid creating an excellent developer onboarding experience with Typescript. ◭ Anil Kumar (@Anil Kumar Krishnashetty) is a Product Manager at Contentful. He is a community builder & prototyper with 10+ years of Frontend product development experience from companies including SAP & Sapient. He has been speaking, writing about rapid prototyping tools, running and facilitating the prototyping community in Berlin. ◭ This talk has been recorded during TypeScript Berlin Meetup. Join our TypeScript Berlin Meetup group here: https://www.meetup.com/TypeScript-Berlin ------------------------ 📚 Resources: ✅ Subscribe to Prisma: https://www.youtube.com/channel/UCptAHlN1gdwD89tFM3ENb6w?sub_confirmation=1 ✅ Get help from the Prisma Community: https://slack.prisma.io/ ✅ Learn more about Prisma: ◭ Website: https://www.prisma.io ◭ Docs: https://www.prisma.io/docs ◭ Quickstart: https://pris.ly/qstart ------------------------ 💬 Connect with Prisma: Twitter: https://twitter.com/prisma Instagram: https://www.instagram.com/prisma.io/ TikTok: https://www.tiktok.com/@prismadata Facebook: https://www.facebook.com/prisma.io LinkedIn: https://www.linkedin.com/company/prisma-io ------------------------ Prisma sponsors human-reviewed, professional closed captions for ANY video valuable to our community (for example, about: Node.js, TypeScript & Type Safety, Prisma, databases, etc). Get your FREE captions here: https://pris.ly/closedcaptions
  • u

    user

    09/05/2021, 2:46 PM
    TypeScript Berlin Meetup #7 - Simon Knott - RTW: designing a library for real-time queries

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

    ◭ In this talk, Simon will introduce RTW, a proof-of-concept library/framework for real-time queries. He'll walk you through typical considerations & design decisions in library design. ◭ Simon (@skn0tt) is a Developer Tooling Engineer. He's a L2 Maintainer at Blitz.js and the Creator of Quirrel, a job queueing solution for Serverless. He takes pride in building tools, libraries & frameworks that help you building applications better. ◭ This talk has been recorded during TypeScript Berlin Meetup. Join our TypeScript Berlin Meetup group here: https://www.meetup.com/TypeScript-Berlin ------------------------ 📚 Resources: ✅ Subscribe to Prisma: https://www.youtube.com/channel/UCptAHlN1gdwD89tFM3ENb6w?sub_confirmation=1 ✅ Get help from the Prisma Community: https://slack.prisma.io/ ✅ Learn more about Prisma: ◭ Website: https://www.prisma.io ◭ Docs: https://www.prisma.io/docs ◭ Quickstart: https://pris.ly/qstart ------------------------ 💬 Connect with Prisma: Twitter: https://twitter.com/prisma Instagram: https://www.instagram.com/prisma.io/ TikTok: https://www.tiktok.com/@prismadata Facebook: https://www.facebook.com/prisma.io LinkedIn: https://www.linkedin.com/company/prisma-io ------------------------ Prisma sponsors human-reviewed, professional closed captions for ANY video valuable to our community (for example, about: Node.js, TypeScript & Type Safety, Prisma, databases, etc). Get your FREE captions here: https://pris.ly/closedcaptions
  • u

    user

    09/05/2021, 2:46 PM
    TypeScript Berlin Meetup #7 - Mughees Ilyas - Understanding Alias types and tuples 101

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

    ◭ In this talk we will go over the Alias types and how are they different from interfaces, what are tuples and what we can do with them. We will also cover how alias in tuples can be used. ------------------------ 📚 Resources: ✅ Subscribe to Prisma: https://www.youtube.com/channel/UCptAHlN1gdwD89tFM3ENb6w?sub_confirmation=1 ✅ Get help from the Prisma Community: https://slack.prisma.io/ ✅ Learn more about Prisma: ◭ Website: https://www.prisma.io ◭ Docs: https://www.prisma.io/docs ◭ Quickstart: https://pris.ly/qstart ------------------------ 💬 Connect with Prisma: Twitter: https://twitter.com/prisma Instagram: https://www.instagram.com/prisma.io/ TikTok: https://www.tiktok.com/@prismadata Facebook: https://www.facebook.com/prisma.io LinkedIn: https://www.linkedin.com/company/prisma-io ------------------------ Prisma sponsors human-reviewed, professional closed captions for ANY video valuable to our community (for example, about: Node.js, TypeScript & Type Safety, Prisma, databases, etc). Get your FREE captions here: https://pris.ly/closedcaptions
  • g

    Gelo

    09/06/2021, 2:29 AM
    Error when using full text search (cloud.prisma.io)
    r
    j
    • 3
    • 16
  • d

    Daniell

    09/06/2021, 8:24 AM
    Struggling trying to look for a solution for mysql on AWS and serverless functions on Vercel, looks like RDS proxy won't work 😅 https://www.prisma.io/docs/guides/deployment/deployment-guides/caveats-when-deploying-to-aws-platforms#aws-rds-proxy does anyone have a solution?
    d
    r
    +2
    • 5
    • 14
  • e

    Erik C

    09/06/2021, 3:31 PM
    I am confused when it comes to pagination with Prisma and how I would do this with GraphQL. I know that you can paginate with Prisma, and you can also paginate with Apollo Client. Should I just choose one over the other - does it matter?
    v
    • 2
    • 6
  • u

    user

    09/06/2021, 4:09 PM
    JS Monthly Meetup - Peter Perlepes - Fully featured auth for your Next.js-Prisma app with Clerk

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

    Authentication should not be that hard and Clerk promises to make it a joy for developers while keeping up to date with the latest trends and standards. In this talk you will learn how to add authentication to your Next.js project, protecting your users and your Prisma database at the application level. ------------------------ 📚 Resources: ✅ Subscribe to Prisma: https://www.youtube.com/channel/UCptAHlN1gdwD89tFM3ENb6w?sub_confirmation=1 ✅ Get help from the Prisma Community: https://slack.prisma.io/ ✅ Learn more about Prisma: ◭ Website: https://www.prisma.io ◭ Docs: https://www.prisma.io/docs ◭ Quickstart: https://pris.ly/qstart ------------------------ 💬 Connect with Prisma: Twitter: https://twitter.com/prisma Instagram: https://www.instagram.com/prisma.io/ TikTok: https://www.tiktok.com/@prismadata Facebook: https://www.facebook.com/prisma.io LinkedIn: https://www.linkedin.com/company/prisma-io ------------------------ Prisma sponsors human-reviewed, professional closed captions for ANY video valuable to our community (for example, about: Node.js, TypeScript & Type Safety, Prisma, databases, etc). Get your FREE captions here: https://pris.ly/closedcaptions
  • u

    user

    09/06/2021, 4:09 PM
    JS Monthly Lunchtime Meetup - Daniel Norman - Making MongoDB Type Safe with Prisma

    https://www.youtube.com/watch?v=kGKQkHZ-Fps▾

    ◭ Type safety is indispensable for developers to be productive and to have strong confidence in their code. While MongoDB is great for developers that need to move quickly, it is not straightforward to access it in a type-safe way. Doing this requires a lot of boilerplate code and manual work to keep database models and application types in sync. ◭ In this talk you’ll learn how Prisma enables developers using MongoDB to model their data with a schema and benefit from a type-safe data access API at a low cost of adoption. ◭ Daniel is a software engineer with broad experience across modern web and cloud environments. He’s passionate about open source and modern development tooling and likes bringing ideas from different disciplines to software development. These days, Daniel is a developer advocate at Prisma, focusing on next-generation database access for Node.js and Typescript. Outside the software world, Daniel is interested in woodworking and motorcycling. ------------------------ 📚 Resources: ✅ Subscribe to Prisma: https://www.youtube.com/channel/UCptAHlN1gdwD89tFM3ENb6w?sub_confirmation=1 ✅ Get help from the Prisma Community: https://slack.prisma.io/ ✅ Learn more about Prisma: ◭ Website: https://www.prisma.io ◭ Docs: https://www.prisma.io/docs ◭ Quickstart: https://pris.ly/qstart ------------------------ 💬 Connect with Prisma: Twitter: https://twitter.com/prisma Instagram: https://www.instagram.com/prisma.io/ TikTok: https://www.tiktok.com/@prismadata Facebook: https://www.facebook.com/prisma.io LinkedIn: https://www.linkedin.com/company/prisma-io ------------------------ Prisma sponsors human-reviewed, professional closed captions for ANY video valuable to our community (for example, about: Node.js, TypeScript & Type Safety, Prisma, databases, etc). Get your FREE captions here: https://pris.ly/closedcaptions
  • h

    Halvor

    09/06/2021, 6:28 PM
    Is there any way to do this query using findMany()?
    Copy code
    SELECT 
    	m.*,
    	d.*,
    	AVG(r.value) AS rating
    FROM "Map" AS m
    JOIN "MapData" AS d ON m."id" = d."mapId"
    JOIN "MapRate" AS r ON m."id" = r."mapId"
    WHERE deleted = false
    GROUP BY m.id, d.id
    ORDER BY rating DESC
    My schema:
    Copy code
    enum MapPlatform {
      XBOX360 // 1
      PS3 // 2
      PC // 3
    }
    
    model Map {
      id         Int         @id @default(autoincrement())
      createdAt  DateTime    @default(now())
      updatedAt  DateTime    @default(now()) @updatedAt
      user       User        @relation(fields: [userId], references: [id])
      userId     Int
      platform   MapPlatform @default(PC)
      uuid       String      @unique @default(uuid())
      title      String
      size       Int
      deleted    Boolean     @default(false)
      mapData    MapData?
      mapRatings MapRate[]
    }
    
    model MapData {
      map                 Map      @relation(fields: [mapId], references: [id])
      mapId               Int
      id                  String   @id
      gamemode            Int
      battlefieldSize     Int
      numberPlayers       Int
      originalCreatorName String
      originalCreatedDate DateTime
      authorName          String
      authorDate          DateTime
      thumbnail           String
    }
    
    enum MapRateType {
      USER
      INAPPROPRIATE
    }
    
    model MapRate {
      map       Map         @relation(fields: [mapId], references: [id])
      mapId     Int
      user      User        @relation(fields: [userId], references: [id])
      userId    Int
      createdAt DateTime    @default(now())
      updatedAt DateTime    @default(now()) @updatedAt
      type      MapRateType @default(USER)
      value     Int
    
      @@id(fields: [mapId, userId])
    }
    What i want to achieve is to maps sorted by the average of
    value
    from the MapRate table, that has a relation with Map table. I imagine this would require both group by and aggregate functions combined with the findMany() is that even possible with prisma?
  • m

    Miguel A. C.

    09/07/2021, 9:59 AM
    Hi there. I'd like to ask for help about sorting when words have accents. For example, I'd like to sort the following words like this:
    Copy code
    Ávila
    Cáceres
    Cantabria
    Ceuta
    But I get the following:
    Copy code
    Cantabria
    Ceuta
    Cáceres
    Ávila
    I'd like to sort using unicode but I haven't found how to do that. Currently I'm using sqlite as my db provider. Could you point me if there's anything I can set at Prisma or Sqlite level? Thanks in advance!
    k
    r
    • 3
    • 5
  • u

    user

    09/07/2021, 10:59 AM
    What's new in Prisma (v3.0.1)

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

    Daniel and Matt from the Prisma team discuss the latest 3.0.1 release of Prisma and other news from the Prisma ecosystem. Tune in to learn about new releases, how to upgrade, planned features, and other interesting bits from the Prisma world. Learn more about Prisma: ◭ Website: https://www.prisma.io​​​​ ◭ Docs: https://www.prisma.io/docs​​​​ ◭ Quickstart: https://www.prisma.io/docs/getting-started/quickstart ◭ Prisma Data Platform: https://cloud.prisma.io/
  • p

    providenz

    09/07/2021, 12:13 PM
    Hi everybody. We have a prisma 2.x web app, and until a few weeks we had no performance problems. We moved the backend from a vps host to a french PAAS provider (Scalingo). Our db (postgre) is still the same managed instance. Since this migration, we have problems with timed out requests, and logs show connexion pooling issues. We tried to play with the settings mentionned in https://www.prisma.io/docs/guides/performance-and-optimization/connection-management , but no success so far. We have few info about what happens, and we’re currently setting up more serious monitoring tools. Did you encounter this kind of issues on other PAAS ?
    r
    j
    • 3
    • 17
  • y

    YeonHoPark

    09/07/2021, 12:32 PM
    Hi, there ! Do you use the type-gen provided by nexus ? if I’m using the User type, this doesn’t seem intutive😭
    Copy code
    const user: NexusGenObjects["User"] = ...
    How do you all user graphql type in typescript? create it manually ? I tried using graphql-code-generator, it was a pity that it did not check whether the resolver of the type field was implemented.
    r
    • 2
    • 5
  • j

    Josef Henryson

    09/07/2021, 2:42 PM
    Hi, I am about to migrate from Prisma 1 to 2 and reading about scalarList - the docs says that it can only be migrated to Postgresql, but I am using MySQL. Is there any way to manage this with MySQL or do I have to migrate my DB to Postgres?
    r
    • 2
    • 1
  • a

    aniraga

    09/07/2021, 2:47 PM
    I'm trying to follow the graphql examples from prisma (and using it with lambda). It's working, but I'm receiving really slow responses with serverless-offline. 3-10 seconds locally. Am I doing something wrong? The same server, with the standard apollo server, no sls-offline is in a few milliseconds max
    Copy code
    ...
    
    exports.graphqlHandler = (
      event: APIGatewayProxyEvent,
      context: Context,
      callback: APIGatewayProxyCallback
    ) => {
      context.callbackWaitsForEmptyEventLoop = false
    
      const server = new ApolloServer({
        schema: schema,
        context: schemaContext,
      })
    
      const handler = server.createHandler()
    
      return handler(event, context, callback)
    }
    r
    r
    • 3
    • 5
  • e

    Erick Petrucelli

    09/07/2021, 2:53 PM
    Hello guys, I'm taking a look at the new Full-Text Search preview feature. But many rows have
    NULL
    values on columns I want to search. It would be easy to use a
    COALESCE
    with a raw query, but I'd like to know: is there a way to force the
    NULL
    values to empty strings in Prisma itself when querying data?
    r
    • 2
    • 1
  • h

    Hyo

    09/07/2021, 2:56 PM
    Have anyone tried
    Prisma
    in termux?
  • u

    user

    09/07/2021, 4:10 PM
    Microsoft SQL Server Support in Prisma is Production-Ready Today we are excited to announce that Prisma support for SQL Server and Azure SQL is Generally Available and ready for production! Prisma helps developers be productive and confident when building data-intensive applications. Try it out
    🎉 7
  • j

    Jacob Simon

    09/07/2021, 4:14 PM
    Apologies if I'm missing something obvious in the docs, but is there a base type for the generated properties on
    PrismaClient
    for each model? E.g. if I have a model
    User
    and
    Article
    is there a base type for
    prisma.user
    such that I can have a function that would accept
    prisma.user
    or
    prisma.article
    like
    function genericSelect(modelRepo: SomeBaseType)
    ?
    r
    • 2
    • 2
  • a

    Alex Okros

    09/07/2021, 6:01 PM
    Would anyone happen to know how to apply Prisma migrations to a database located on an AWS Bastion?
    r
    • 2
    • 1
1...478479480...637Latest