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

    Gardian Memeti

    10/04/2021, 2:15 PM
    Hallo to everyone, i have one question. I have rest api and one endpoint is with GET to monitoring database. How can I handle DB Exceptions and logg if the are any issues?
    r
    • 2
    • 3
  • u

    user

    10/04/2021, 2:38 PM
    What's new in Prisma (v3.2.0)

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

    Daniel and Niko from the Prisma team discuss the latest 3.2.0 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. —————————————————— 👉 Check the previous video: What's new in Prisma (v3.1.1)

    https://youtu.be/nLHJCzWxS5M▾

    —————————————————— ✅ Subscribe to Prisma's YouTube channel https://www.youtube.com/channel/UCptAHlN1gdwD89tFM3ENb6w?sub_confirmation=1 —————————————————— 📚 Learn more about Prisma ◭ Website: https://www.prisma.io ◭ Docs: https://www.prisma.io/docs ◭ Quickstart: https://pris.ly/qstart —————————————————— ❓ Get help with Prisma issues • Slack: https://slack.prisma.io • GitHub: https://www.github.com/prisma/prisma/discussions • Stackoverflow: https://stackoverflow.com/questions/tagged/prisma —————————————————— 💬 Follow Prisma on social media • 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/pris... —————————————————— 🔠Professional captions for your technical videos 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
    ✅ 1
  • r

    Richard Prins

    10/04/2021, 3:55 PM
    I was wondering if someone could help me out with a question: what are the letter casing rules when querying or mutating tables with multiple words? I see examples use for User being db.user.create() or .findFirst() But what about something like a model named PreReleaseSignup defined in my schema.prisma file, would I just query it like db.preReleaseSignup.create() ? I have many tables that are longer 2-4 word names so this would sort of help overall
    r
    • 2
    • 1
  • f

    Farki

    10/04/2021, 6:55 PM
    Hi guys, do any of you use dependency injection (syringe)? I am trying, but no luck:
  • h

    Harjaap Singh Makkar

    10/04/2021, 8:00 PM
    Copy code
    {
      "error": "\nInvalid `prisma.want.create()` invocation:\n\n\n  Failed to validate the query: `Field does not exist on enclosing type.` at `Mutation.createOneWant`"
    }
    Hello everyone, ^ that's the error I've hit. 'Wants' is a new table I've added, I've completed the migration and run prisma generate with no issues. It's a fairly simple table and I'm supplying all the needed fields. I'd really appreciate any insights!
    r
    • 2
    • 3
  • a

    Andrew Valleteau

    10/04/2021, 8:06 PM
    Hi everyone. My team and I are experiencing some corner-case issues when using prisma "transactions" with postgres database. Basically we have unrecoverable "idle in transaction" sessions which make all our subsequent DB queries timeout. I've opened an issue about it here: https://github.com/prisma/prisma/issues/9584 and I'm working on a MRE. However, I do wonder, does anyone in the community already had experienced this kind of issue under high load / lock intensive queries / low ressources environment ? And does anyone have found a suitable solution for it ? (for me the only mitigation I found ATM is to refactor my code to avoid transaction (I loose the rollback ability and the database integrity but it doesn't hang forever))
  • b

    Brent Leemans

    10/04/2021, 8:24 PM
    Hi! Is there a way to default to a unix timestamp instead of using now() in your prisma schemas?
    a
    r
    • 3
    • 2
  • m

    Michael

    10/04/2021, 8:30 PM
    hi, anyone know I'm getting this typescript error for prisma events?
    a
    • 2
    • 6
  • e

    Eduardo Del Balso

    10/04/2021, 10:00 PM
    Hello Everyone! I’m trying to implement application-level encryption in our middleware, but I noticed that middleware only triggers for the root action, and I’d have to build complex traversal of the params to handle encryption of the fields on the nested models that will be created/updated as a result of this root action. Before I go and implement that traversal and cross-checking with the schema, I have to ask: Am I doing something wrong? Is there a simple way to intercept and modify attributes of a model before they get written/read from the database without requiring complex processing of this sort in the nested actions case?
    r
    j
    • 3
    • 34
  • c

    Chip Clark

    10/05/2021, 2:12 AM
    Trying to filter WHERE on subtable of a subtable Comittee is the primary table - PersonCommittee is a subtable, where Person is a subtable of PersonCommittee. The following doesn't return an error, but it does return data that does not meet the criteria.
    Copy code
    this.prisma.committee.findMany({
            include: {
              PersonCommittee: {
                include: {
                  Person: {
                    select: {
                      PKPersonID: true,
                      LastName: true,
                      FirstName: true,
                      MiddleName: true,
                      PreferredFirstName: true,
                      DisplayName: true,
                      EmploymentStatus: true
                      }
                    }
                  }
                }
            },
            where: {
              AND: [
                {
                  Active: true,
                  PersonCommittee: {
                    some: {
                      Person: {
                        EmploymentStatus: "A" 
                      }
                    }
                  }
                }
              ]
            },
          })
    r
    • 2
    • 10
  • c

    Chip Clark

    10/05/2021, 2:17 AM
    This doesn't work either:
    Copy code
    this.prisma.committee.findMany({
            include: {
              PersonCommittee: {
                include: {
                  Person: {
                    select: {
                      PKPersonID: true,
                      LastName: true,
                      FirstName: true,
                      MiddleName: true,
                      PreferredFirstName: true,
                      DisplayName: true,
                      EmploymentStatus: true
                      }
                    }
                  }
                }
            },
            where: {
              Active: true,
              PersonCommittee: {
                some: {
                  Person: {
                    OR: [
                      {
                        EmploymentStatus: "A"
                      },
                      {
                        EmploymentStatus: "L"
                      },
                      {
                        EmploymentStatus: "C"
                      },
                    ],
                  }
                }
              }
            }
          })
  • j

    James

    10/05/2021, 4:28 AM
    Anyone know how to use PostgreSQL
    smallint
    in a Prism schema?
  • j

    James

    10/05/2021, 4:30 AM
    The docs on this are here: <https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#postgresql-2> But it's not super clear what to do. I tried putting
    @db.SmallInt
    in my schema, but that gave an error in VSCode.
  • c

    Chris Tsongas

    10/05/2021, 4:31 AM
    @db.SmallInt
    works just fine for me.
  • j

    James

    10/05/2021, 4:32 AM
    Copy code
    model Games {
      id         Int    @id @default(autoincrement())
      name       String
      numPlayers @db.SmallInt
    }
    Error validating: This line is not a valid field or attribute definition.
  • c

    Chris Tsongas

    10/05/2021, 4:33 AM
    Needs to be
    numPlayers Int @db.SmallInt
    the
    Int
    part is the Prisma type, the other part is the Postgres type.
    💯 1
  • j

    James

    10/05/2021, 4:33 AM
    oh, that makes a lot of sense 🙂
  • j

    James

    10/05/2021, 4:34 AM
    thank you!
    💯 1
  • c

    Chris Tsongas

    10/05/2021, 4:35 AM
    Yeah you only need to add the Postgres type if you want something different from the Prisma default.
  • c

    Chris Tsongas

    10/05/2021, 4:35 AM
    However the Prisma type is mandatory.
  • d

    Dante

    10/05/2021, 5:27 AM
    Found type miss in https://www.prisma.io/blog/fullstack-nextjs-graphql-prisma-2-fwpc6ds155.
    🙌 1
    r
    m
    • 3
    • 4
  • u

    user

    10/05/2021, 6:47 AM
    Creating Object Types Using Nexus

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

    In this video, you'll learn how to define Object Types using Nexus, a GraphQL schema construction library Timestamps: 00:00 - Creating the Link Object Type 2:10 - Creating the User Object Type 4:17- Passing the User and Link Object Types to the
    makeSchema
    function Useful links: • Nexus docs - Object Type: https://nexusjs.org/docs/api/object-type • Nexus: https://nexusjs.org • The problems of "Schema-first" GraphQL Development: https://www.prisma.io/blog/the-problems-of-schema-first-graphql-development-x1mn4cb0tyl3 • GitHub repo: https://github.com/m-abdelwahab/awesome-links • Part 2 blog post: https://prisma.io/blog/fullstack-nextjs-graphql-prisma-2-fwpc6ds155 • Part 1 blog post: https://prisma.io/blog/fullstack-nextjs-graphql-prisma-oklidw1rhw 👉 Next video: Creating Object Types Using Nexus -

    https://www.youtube.com/watch?v=NaxQXClnYSE&amp;list=PLn2e1F9Rfr6k6MwzS-p9FGK1NDBxxwLPk&amp;index=14&amp;pp=sAQB▾

    👉 Previous video: Building a GraphQL API using Nexus, Prisma, and Next.js -

    https://www.youtube.com/watch?v=auckcBaZifw&amp;list=PLn2e1F9Rfr6k6MwzS-p9FGK1NDBxxwLPk&amp;index=13&amp;pp=sAQB▾

    👉 Check out the full playlist: https://www.youtube.com/playlist?list=PLn2e1F9Rfr6k6MwzS-p9FGK1NDBxxwLPk
    d
    • 1
    • 1
  • m

    Mykyta Machekhin

    10/05/2021, 9:52 AM
    Hi guys. I have an entity and I want to insert into it only those rows from the array that have not yet existed according to my uniqueness condition (a set of 4 fields). I have the following code. But sometimes, nevertheless, for some reason, a uniqueness error flies out. Can someone explain why?
    r
    • 2
    • 13
  • t

    terion

    10/05/2021, 12:08 PM
    Hello. Prisma team, can you please react on this bug? It is a big bummer breaking a lot of things https://github.com/prisma/prisma/issues/9590
    r
    • 2
    • 6
  • j

    Jack Reed

    10/05/2021, 12:10 PM
    Hi there, Is there a standard practice for prisma apps in creating data migrations?
    r
    • 2
    • 6
  • l

    Leo Li

    10/05/2021, 3:59 PM
    Hello, does any one know if there is a way in prisma to only allow update a field only when it is empty? The use case is like timestamp for
    createdAt
    , I want to ensure the value is locked.
    r
    • 2
    • 2
  • c

    Chris Tsongas

    10/05/2021, 4:54 PM
    Does anyone add logic to their
    prisma/seed.ts
    file to seed their development database with dummy data to help with coding, that doesn't get seeded in production? I'm thinking I'd like to do that by checking
    if (process.env.NODE_ENV === 'development')
    for certain things in my seed file, am I crazy or is this an O.K. idea?
    s
    r
    • 3
    • 4
  • s

    Scott Berry

    10/05/2021, 5:00 PM
    I don't really know where to get an answer for this, but this seemed like a good place for it. Prisma is now written in Rust, but why aren't there any bindings for Rust? There are certain use cases where I would like to leverage Rust but am forced to do a workaround instead, there's Go bindings, but the languages it's built-in, doesn't. Seems odd.
    j
    • 2
    • 10
  • u

    user

    10/06/2021, 6:07 AM
    Define GraphQL Queries using Nexus

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

    In this video, you'll learn how to define Object Types using Nexus, a GraphQL schema construction library Useful links: • Nexus docs - `extendType`: https://nexusjs.org/docs/api/extend-type • Nexus: https://nexusjs.org • The problems of "Schema-first" GraphQL Development: https://www.prisma.io/blog/the-problems-of-schema-first-graphql-development-x1mn4cb0tyl3 • GitHub repo: https://github.com/m-abdelwahab/awesome-links • Part 2 blog post: https://prisma.io/blog/fullstack-nextjs-graphql-prisma-2-fwpc6ds155 • Part 1 blog post: https://prisma.io/blog/fullstack-nextjs-graphql-prisma-oklidw1rhw 👉 Next video: Setting up Apollo Client 3 with Next.js -

    https://www.youtube.com/watch?v=NaxQXClnYSE&amp;list=PLn2e1F9Rfr6k6MwzS-p9FGK1NDBxxwLPk&amp;index=16&amp;pp=sAQB▾

    👉 Previous video: Creating Object Types Using Nexus -

    https://www.youtube.com/watch?v=NaxQXClnYSE&amp;list=PLn2e1F9Rfr6k6MwzS-p9FGK1NDBxxwLPk&amp;index=14&amp;pp=sAQB▾

    👉 Check out the full playlist: https://www.youtube.com/playlist?list=PLn2e1F9Rfr6k6MwzS-p9FGK1NDBxxwLPk
  • j

    Josef Henryson

    10/06/2021, 6:33 AM
    After prisma generate I get this message, is it something to be concerned about? Can I upgrade from 3.1.1?
    r
    • 2
    • 2
1...490491492...637Latest