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

    Lennard

    07/03/2022, 11:15 AM
    Hey!
    👋 1
  • a

    Annu Singh

    07/03/2022, 12:43 PM
    Hi, I'm facing a serious issue. My schema.graphql(created by Nexus) is not updating with the correct types, there is a Typescript error in my resolver and I'm unable to start the server which would've helped in syncing up my schema file. Can someone advise what I can do?
    ✅ 2
    v
    • 2
    • 4
  • k

    KJReactor

    07/03/2022, 7:20 PM
    Currently, the
    @unique
    or
    @@unique
    directives do not work with MongoDB. I thought of using JSON schema for validation / prevent duplications but that is not supported as far as I am aware unless using Realm. Has anyone figured out a workaround ?
    ✅ 1
    n
    • 2
    • 2
  • j

    Jean Moirano

    07/04/2022, 7:43 AM
    Hello to all, I cant' succeed to open "prisma studio" when connected to Supabase, got this error and crashes: "Command was killed with SIGSEGV (Segmentation fault", the migration was successful. Any infos? Same code works nicely with cockroachDB!
    ✅ 1
    n
    • 2
    • 2
  • g

    Gezim

    07/04/2022, 10:16 AM
    Does prisma client do any query/insert batching? I’m still using TypeORM along side Prisma and getting weird behaviour (I think), where a Prisma insert doesn’t appear in a TypeORM query. Thoughts?
    ✅ 1
    h
    • 2
    • 1
  • a

    Adam Boulila

    07/04/2022, 11:33 AM
    Copy code
    this.prismaService.brand.findMany({
        where: {
            providerSKU: Providers.ccado,
        },
        cursor: {
            id: body.cursor,
        },
        take: body.take ? body.take : DEFAULT_TAKE,
        include: {
            pdf: true,
            variants: true,
        },
        orderBy: {
            id: 'asc',
        },
    })
    `````` with the following code snippet, if i supply a
    cursor.id
    that is not available (example:
    cursor.id: 5
    and 5 do not exist) in the database prisma returns nothing, even though there are elements before and after the unavailableId, is this by design or a bug, I would assume the default behavior is to start from the next available ID
    ✅ 1
    👀 1
    n
    • 2
    • 6
  • k

    KJReactor

    07/04/2022, 2:52 PM
    How would one use ``$runCommandRaw`` in order to get all collection names with the MongoDB ``getCollectionNames`` command? I'm attempting to clear my db (not delete) by looping over the names and running ``deleteMany`` (not for production so its ok).
    ✅ 1
    p
    n
    • 3
    • 6
  • i

    Ian Unsworth

    07/04/2022, 4:16 PM
    👋 Hi everyone, great to be here! We at MindsDB (an open source In-Database Machine Learning platform) have had a very popular community request to support Prisma as part of a Dev contest. Are you able to help us to democratize Machine Learning by contributing a Prisma integration? To start, check out the GitHub contest rules and rewards, Building new integration docs or join our community slack.
    ✅ 1
    n
    • 2
    • 2
  • d

    Devan Patel

    07/04/2022, 8:29 PM
    Hey guys, we are using nextjs middleware feature, and from middleware we are calling prisma client (that calls postgres) but it is showing me this error.
  • d

    Devan Patel

    07/04/2022, 8:29 PM
    👀 1
    k
    r
    v
    • 4
    • 3
  • d

    Devan Patel

    07/04/2022, 8:29 PM
    Can anyone help me out
  • g

    Gezim

    07/05/2022, 6:27 AM
    Does
    Primsa.$queryRaw
    allow me to compose a query string based on a few criteria? With TypeORM, I’m using a query builder and adding
    leftJoinAndSelect
    where
    groupBy
    all conditionally. How would I do that in Prisma?
    ✅ 1
    n
    • 2
    • 4
  • a

    Annu Singh

    07/05/2022, 7:17 AM
    I'm facing error while accessing home page after logging in my app (only when there is a cookie present). Error: expected Undefined to be a GraphQl schema. All queries/mutations are working fine in Apollo playground. Earlier it was working fine, but I made some changes to one of my GraphQl type and I guess it is because of that. Tech used: Prisma, GraphQl,Apollo, Nexus, Next.js Can someone please suggest a solution?
    🤔 1
    👀 1
    n
    • 2
    • 3
  • u

    user

    07/05/2022, 8:42 AM
    👉 A Practical Introduction to Prisma (Workshop) | Prisma Day 2022 --

    https://www.youtube.com/watch?v=Mnk-fbykw1o▾

    -- In this workshop, you’ll learn the fundamentals of using Prisma and practice various workflows, from modelling data, to performing database migrations, to querying the database to read and write data. You’ll also learn how Prisma fits into your application stack by integrating in a REST and a GraphQL API using a SQLite database. 000000 Welcome & Introduction 000714 What is Prisma? 001734 Set up Prisma with SQLite 003620 Sending queries with Prisma Client 011400 Prisma in a GraphQL API 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! 🐦 Connect with Nikolas: https://twitter.com/nikolasburk
    👋 2
    prisma rainbow 4
  • m

    Michael Roberts

    07/05/2022, 10:42 AM
    Hey, just wondering … with a
    finaMany
    lookup - is there a way to NOT paginate results, I’m filtering off of a start and end period, so I don’t envisage the return to be too large, but I’d like to not paginate, and return all as the default? Could anyone advise please 🙏
    👀 1
    a
    v
    • 3
    • 4
  • a

    AnimeshRy

    07/05/2022, 11:14 AM
    Hey Team, Could anyone help me decide if prisma is ready for production or not ? I've used it for small projects but haven't seen an industry project for this. There are 2k + issues currently. Migration can't be rolled back schema file gets too large even my personal projects so not sure how can I break the file. I'm not sure but the ORM scene in node is bad, the Django ORM although using python is very nice and does everything you need from it. I wish I could find something like that on node
    v
    o
    n
    • 4
    • 3
  • p

    pmaneesh03

    07/05/2022, 11:55 AM
    I am facing an issue in prisma https://stackoverflow.com/questions/72828692/please-make-sure-your-database-server-is-running-at-localhost5432-prisma please help me to fix this issue
    👀 1
    m
    a
    • 3
    • 5
  • h

    Harsh Singh

    07/05/2022, 4:11 PM
    I found this video on YouTube if anybody is interested:

    https://youtu.be/RebA5J-rlwg▾

    prisma rainbow 4
    n
    • 2
    • 1
  • h

    Harsh Singh

    07/05/2022, 4:12 PM
    It's from Web Dev Simplified. Goes over almost everything a beginner would need to start using Prisma. Just published ~5 minutes ago.
  • j

    Joe

    07/05/2022, 7:13 PM
    Is there a recommendation on how to handle image file, or regular file, uploads? Keep the file as is, or base64 encode to the database?
    ✅ 1
    r
    • 2
    • 7
  • j

    Jeremy Cohen Hoffing

    07/05/2022, 7:45 PM
    Are data migrations with Prisma (and more specifically for working with Planetscale) still unsupported? Comment from 4 months ago: https://prisma.slack.com/archives/CA491RJH0/p1647556028544079?thread_ts=1647490664.669059&cid=CA491RJH0 Existing issues: https://github.com/prisma/prisma/discussions/8933 https://github.com/prisma/prisma/issues/6345 This is an essential feature that’s seems like it’s still missing, what gives? What would a good workaround be? Just create javascript code in files in a prisma/migrations folder to migrate some data, and override the db url in
    new PrismaClient()
    to point to the db URL you want to run them on? It seems crazy to not have this when most other ORMs have this capability, at the very least it would be nice to have some documentation and examples for any potential solutions or workarounds instead of pointing users to old articles or other third-party solutions.
    👀 1
    ✅ 1
    a
    v
    n
    • 4
    • 5
  • a

    Arthur Kam

    07/05/2022, 10:02 PM
    Hello 👋 I have a prisma migration problem / solution I want to get a sense check on. Currently, we have CI set to run migrations on a newly spun up docker container which helps with ensuring migrations take place in the right order. But we’re running into an issue where devs are generating migrations that break production (i.e. renaming column drops column and adds a new one rather than copy / rename). Is the best solution to write a CI job that does a dry run against staging/production where there is data to catch bad migrations? Thanks in advance!
    ✅ 1
    👋 1
    a
    • 2
    • 2
  • h

    humblecoder

    07/06/2022, 1:45 AM
    Hi All, I’m using
    Prisma 4.0.0
    but for some reason
    where: {  my_json_field: Prisma.DbNull } ,
    still throws
    JsonNullableFilter
    TS error. Any ideas on what I could be missing?
    ✅ 1
    a
    • 2
    • 3
  • p

    Priyanshi Gupta (YB)

    07/06/2022, 5:58 AM
    Hey Everyone, Is there any guidelines for the integration of supporting a new Database. if yes, please let me know where can I find one?
    ✅ 1
    a
    • 2
    • 2
  • l

    Liz Mowforth

    07/06/2022, 6:37 AM
    ➡️❗*Reminder to register your interest for our upcoming feedback sessions.* Filling in the survey takes less than 2 minutes and if you take part in a session, you'll be compensated for your time. Plus: We promise it'll be fun. prisma rainbow 🤸 ⭐
    prisma rainbow 1
  • l

    Louis Joubert

    07/06/2022, 7:51 AM
    I am just trying to understand the documentation regarding environment variables at https://www.prisma.io/docs/guides/development-environment/environment-variables. The last paragraph states that I should load them manually at runtime, but I find that just importing PrismaClient does that automatically? So
    Copy code
    import { PrismaClient } from "@prisma/client";
    console.log(process.env.TEST);
    will pull
    TEST
    from my
    .env
    file? Earlier the docs say
    When you use Prisma CLI or Prisma Client, the .env file content and the variables defined in there are put into the system's environment, where Prisma can read it and use it.
    When it says using Prisma Client, does that mean using PrismaClient in your code, as opposed to using some CLI command? I would prefer that it doesn't pull in stuff automatically, but I guess that just means I should not have any stray .env files lying around.
    p
    r
    c
    • 4
    • 13
  • u

    user

    07/06/2022, 8:00 AM
    👉 Deep dive into database workflows with Prisma - Alex Ruheni I Prisma Day 2022 --

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

    -- By the end of this workshop, you will learn how to work with features such as schema prototyping with Prisma Migrate, working with database native types, how to use Prisma Migrate in your development and CI/ CD environment, and build workflows using the-lesser-known features of Prisma Migrate. 000000 Welcome and Introduction 000230 Lesson 1: Migration fundamentals 001232 Lesson 2: Schema prototyping 002708 Lesson 3: Developing with Prisma Migrate 003633 Lesson 4: Customizing migrations 005215 Lesson 5: Running Prisma Migrate in CI and Production 010417 Lesson 6: Troubleshooting failed migrations 🐦 Connect with Alex: https://twitter.com/ruheni_alex
    prisma rainbow 1
    👀 1
  • h

    Halvor

    07/06/2022, 8:02 AM
    Shouldn't there always be an Index on the @id field? Seems like a lot of my tables in db is missing them... Why?
    ✅ 1
    y
    n
    • 3
    • 3
  • a

    Aydrian Howard

    07/06/2022, 1:25 PM
    Howdy, I'm trying to get the TypeScript type for a Model where I'm also selecting fields from a related model. If I use
    import type { CartItem } from "@prisma/client";
    , that type doesn't include the product fields. Here is my query:
    Copy code
    const items = await db.cartItem.findMany({
      select: { id: true, product: { select: { name: true, price: true } } },
      where: { userId }
    });
    Thanks
    ✅ 1
    n
    • 2
    • 5
  • a

    Aydrian Howard

    07/06/2022, 2:23 PM
    Another issue I'm having is with the Decimal type. I'm trying format the value as USD using
    new Int.NumberFormat(...).format()
    and it takes a number. It looks like I should be able to do
    .toNumber()
    on the Decimal type to get it as a number, but I get an error that it's not a function. If I do
    .toString()
    that works but TypeScript is unhappy. Here is my code:
    Copy code
    {new Intl.NumberFormat("en-US", {
      style: "currency",
      currency: "USD"
    }).format(product.price.toString())}
    Has anyone ran into something like this using the Decimal type?
    n
    a
    • 3
    • 4
1...593594595...637Latest