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

    user

    02/12/2022, 8:01 AM
    GraphQL Berlin Meetup #25 - Jason Kuhrt - Diving into the new Nexus Prisma

    https://www.youtube.com/watch?v=YGbg2ZGg3-Q▾

    ◭ The goal is to briefly introduce what Nexus Prisma is and then focus on its internals. While Nexus Prisma is not a very active project the talk should be of interest to people curious how a Prisma generator can work generally too. ◭ Jason is a software engineer with a passion for developer experience, system design, and tooling. Educated in design theory, practice, and ethics he became fascinated by the systems aspects of software and the community of open source. Over years his journey progressed from the frontend to the back where he has delved into APIs services DevOps architecture and more. He has made creative and leadership contributions in many environments, mostly startups. Today he leads the Developer Productivity team at Prisma responsible for the Control Plane product of the Prisma Data Platform. ◭ Get in touch with Jason: https://twitter.com/JasonKuhrt ◭ Join our GraphQL Berlin Meetup group: https://www.meetup.com/graphql-berlin
    prisma rainbow 2
  • v

    VR

    02/12/2022, 12:52 PM
    Hello team, we would like to migrate lookup data from one db environment to other environments as part of Prisma model migration CI/CD pipeline, Can you suggest how to achieve that? Highly appreciated for your response on this
  • p

    Peter Kellner

    02/12/2022, 3:33 PM
    Using the where clause with Prisma, is there a way to create the equivalent of a SQL IN clause? That is, something like this where trackSessionIds is an array of integers and Id is the primary key of TrackSession
    Copy code
    const data = await prisma.TrackSession.findMany({
      where: {
        Id: trackSessionIds,
      },
    });
    m
    • 2
    • 2
  • n

    Nick B

    02/12/2022, 6:50 PM
    Hi all! Relatively new to full stack dev. I'm interested in looking at examples of using prisma with nextjs that has filters, i.e. text search, category filter, sort asc/desc etc.
  • n

    Nick B

    02/12/2022, 6:50 PM
    Does anyone know of any resources or gits like this that I could check out?
    e
    n
    • 3
    • 3
  • j

    jt

    02/13/2022, 7:08 AM
    Hey everyone! I'm working on seeding my database (with prisma 3.7) and I can get the data to seed properly, but I'm trying to figure out how to reset all the auto-incremented sequences in my database. Most of my IDs are auto-incremented INTs and I need those to get reset each time I seed. I found some code like this `await prisma.$queryRaw`ALTER TABLE Product AUTO_INCREMENT = 1`;` but that gives me an error and I think it's because I'm using postgres. So I tried something like this `await prisma.$queryRaw`TRUNCATE User RESTART IDENTITY`;`, but unfortunately that is throwing the following error: `Raw query failed. Code:
    42601
    . Message: `db error: ERROR: syntax error at or near "user"`` and if I run that same query but on a different model, "budget", for example, I'm getting this error:
    'relation "budget" does not exist'
    . Any help would be greatly appreciated. Thanks!
    ✅ 1
    e
    • 2
    • 3
  • u

    user

    02/13/2022, 8:31 AM
    GraphQL Berlin Meetup #25 - Jamie Barton - Federating the Content Layer with GraphCMS

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

    ◭ You might think a Headless CMS just provides content, but what if you could federate content from all of your APIs, and enhance that data with content from the CMS? What if I also told you that a GraphQL backend CMS with Mutations allowed you to generate content outside of the CMS. In this talk, we’ll cover what it was like before we used a CMS, what the CMS solves today, as well as where we believe the future is with content by federating all of your services into one. ◭ Jamie is a software engineer turned developer advocate. Born and bred in North East England, he loves learning and teaching others through video and written tutorials. Jamie maintains Headless Dropshipping Starter, Headless Commerce Resources, and GraphQL WTF. ◭ Get in touch with Jamie: https://twitter.com/notrab ◭ Join our GraphQL Berlin Meetup group: https://www.meetup.com/graphql-berlin
    prisma rainbow 1
  • d

    dhatGuy

    02/13/2022, 4:18 PM
    Hi everyone. I'm encountering an error creating an
    order
    .
    • 1
    • 3
  • p

    prisma chobo

    02/13/2022, 6:50 PM
    getting *ConnectionError(Timed out during query execution.) error when using Promise.al*l for SQLite... Is there any workaround or solution for this? It seems there are not much information about this issue...
    j
    • 2
    • 2
  • m

    Mradul Jain

    02/14/2022, 11:36 AM
    hello everyone, i want to json in mssql datatype with prisma, but i can't store it. when i am storing it with a type nvarchar it will give me an error
    Copy code
    \"\\nInvalid `prisma.configuration.upsert()` invocation:\\n\\n{\\n  where: {\\n    id: 1\\n  },\\n  update: {\\n    document: {\\n      baseUrl: '<http://www.kklawportal12.com|www.kklawportal12.com>'\\n      ~~~~~~~\\n    }\\n  },\\n  create: {\\n    document: {\\n      baseUrl: '<http://www.kklawportal12.com|www.kklawportal12.com>'\\n    }\\n    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n  }\\n}\\n\\nUnknown arg `baseUrl` in update.document.baseUrl for type NullableStringFieldUpdateOperationsInput. Did you mean `set`? Available args:\\ntype NullableStringFieldUpdateOperationsInput {\\n  set?: String | Null\\n}\\nArgument document: Got invalid value \\n{\\n  baseUrl: '<http://www.kklawportal12.com|www.kklawportal12.com>'\\n}\\non prisma.upsertOneConfiguration. Provided Json, expected String or Null.\\n\\n\""
  • m

    Mischa

    02/14/2022, 1:01 PM
    Any idea what this error means?
    Copy code
    {
      is_panic: false,
      message: 'Transaction API error: Unable to start a transaction in the given time.',
      meta: { error: 'Unable to start a transaction in the given time.' },
      error_code: 'P2028'
    }
    Tried looking it up here but P2028 is missing
    t
    • 2
    • 1
  • m

    Michael Gardner

    02/14/2022, 3:23 PM
    where do we request/look-up future features? my request is a "read-only" option for prisma to not modify anything in the database for read-only user instances
    t
    • 2
    • 5
  • r

    Rene Nielsen

    02/14/2022, 8:29 PM
    ⚠️ Yo boys and girls: Please help me, how do i fix this. I want a course to have the possibility to have 2 different topics attached (main and sub). Removed all irrelevant properties from the example. I am never fetching the topic + courses, always courses by a topicId but i can’t remove the relation from Topic apparantly.
    Copy code
    model Course {
      topic           Topic           @relation("Topic", fields: [topicId], references: [id])
      topicId         String          @db.ObjectId
      subTopic        Topic           @relation("SubTopic", fields: [subTopicId], references: [id])
      subTopicId      String          @db.ObjectId
    }
    
    model Topic {
      courses.        Course[] ????
    }
    n
    • 2
    • 2
  • n

    Nick B

    02/14/2022, 10:49 PM
    How could one set up a text filter, for example, a text input that filters on a title after displaying findMany?
    n
    • 2
    • 1
  • n

    Nick B

    02/14/2022, 10:49 PM
    Using, prisma + nextjs
  • r

    Ramu Narasinga

    02/15/2022, 6:31 AM
    Hi, Using interactive transactions, my unit test coverage is very low for a service file:
    Copy code
    File                                  | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                                         
    CardService.ts            |  26.09 |   16.67 |  44.44 |  26.09 | 47-48,65-77,98-109,133-203,226-291
    A code snippet of
    prisma
    transaction I use in
    Cardservice
    is as follows:
    Copy code
    archiveCard(cardId: number): Promise<Card> {
        return this.prisma.$transaction(async (prisma) => {
          #47 await this.handleOriginalPosition(cardId, prisma);
          #48 return prisma.card.update({
            where: { id: cardId },
            data: { CardMisc: { update: { isArchived: true } } },
          });
        });
    }
    The above snippet has line #47-48, is there a way we could perform unit tests on code written inside transaction function? We use similar transactions in lines:
    65-77,98-109,133-203
  • u

    user

    02/15/2022, 8:29 AM
    💡 4 Amazing libraries to supercharge your Prisma experience! #shorts

    https://www.youtube.com/watch?v=rCrnhms-pRk▾

    prisma rainbow 1
    👍 2
  • c

    Callum

    02/15/2022, 9:41 AM
    Hey guys, can we ask for database design advice here?
    prisma rainbow 1
    👋 1
    n
    • 2
    • 2
  • s

    Slackbot

    02/15/2022, 12:05 PM
    This message was deleted.
    n
    m
    c
    • 4
    • 4
  • c

    Cristian

    02/15/2022, 12:33 PM
    Hey everyone!
    prisma rainbow 1
    🙌 2
  • g

    Gustavo Farias

    02/15/2022, 1:24 PM
    I have been researching about Prisma Client's SQL injection protection and can't find much on the matter. I did find the line on the docs saying that it mitigates SQL injections, but that didn't inspire a lot of confidence. Does anyone have something to share on this? Am I in the clear while not using raw queries and sticking to Prisma Client? Or should I still sanitize before insertions?
  • a

    Adam Szeptycki

    02/15/2022, 1:28 PM
    Is there something I can use to sanitize variables I want to use in
    queryRawUnsafe
    g
    • 2
    • 4
  • r

    Ryan Gibbs

    02/15/2022, 2:33 PM
    Hey there 👋, Does anyone know why Prisma requires a reference to the
    schema.prisma
    file at runtime? I would have assumed that once the client is generated via
    prisma generate
    and the typescript files are compiled then there would be no need to reference the schema file at all? 🤔 I am asking as I am currently getting the following issue at runtime:
    Copy code
    Error: ENOENT: no such file or directory, open '...path/schema.prisma'
    I assume it is caused by or related to this current issue
  • l

    Leonard Filip

    02/15/2022, 4:29 PM
    Hello. I get this error when running
    prisma migrate dev
    .
    Error: Migration engine error:
    Schema directory './project' already exists. This must be resolved manually (e.g. by moving the schema directory to another location). This generator block inside `schema.prisma`:
    Copy code
    generator client {
    	provider = "prisma-client-js"
    	binaryTargets = ["native", "rhel-openssl-1.0.x"]
    	output = "../node_modules/.project/service/db"
    }
    Has anyone seen this before?
    • 1
    • 1
  • z

    zomars

    02/15/2022, 4:53 PM
    Morning mates! Is there a way to test out the Preview Databases

    mentioned here▾

    ?
    n
    • 2
    • 2
  • s

    Slackbot

    02/15/2022, 7:48 PM
    This message was deleted.
    s
    • 2
    • 4
  • d

    Dennis Gyurics

    02/15/2022, 10:30 PM
    Posted a question here. Does Prisma support storing and running one-time DML statements, like an
    UPDATE
    , automatically?
    n
    • 2
    • 1
  • p

    Peter Kellner

    02/15/2022, 11:01 PM
    How can I create a "Where" clause with an OR. I get that if I list multiple values in the where, they are all "AND"ed together. How to I make OR (or combinations of AND and OR's. I tried this as a wild guess but obviously too wild a guess. (lines 3-7 or so)
    Copy code
    const localData = await context.prisma.Sessions.findMany({
      where: {
        CodeCampYear: {
          UrlPostToken: year
        } || {
          Id: codeCampYearId
        }
      },
      select: {
        Id: true,
        CodeCampYearId: true,
        Title: true,
        CodeCampYear: {
          select: {
            Id: true,
            UrlPostToken: true,
          },
        },
      },
    });
    t
    • 2
    • 3
  • y

    YeonHoPark

    02/16/2022, 1:57 AM
    Hello. What method or library are you using to check validation of input values of query and mutation ?🤔
    k
    n
    • 3
    • 6
  • k

    Kelly Copley

    02/16/2022, 5:12 AM
    All of the sudden I'm getting this error.. I don't know what happened because this same query has been working for months now unchanged and all of the sudden here it is.. Any help is much appreciated.
    Copy code
    In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'wcona.Session.id'; this is incompatible with sql_mode=only_full_group_by
1...545546547...637Latest