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

    mooy bot

    12/14/2021, 6:07 AM
    I have something like this now I was wondering if there is a way I can not make use of
    previousTeam
    and just directly get
    players
    somehow inside of update?
  • c

    Chris Bitoy

    12/14/2021, 8:58 AM
    Good morning y’all. Can you tell me why I am getting ‘missing’ for all these scalar fields even though I used “?” to make them optional? Schema:
    Copy code
    model Campaign {
      id                   Int      @id @default(autoincrement())
      campaign_name        String   @unique @default(uuid())
      campaign_type        String   @default("direct")
      owner_id             Int      @unique @default(1)
      start_date           DateTime @default(now())
      sponsor_id           String?  @default(cuid())
      campaign_details     String?
      campaign_budget      Int?
      point_value          Int?
      s1_points            Int?
      s2_points            Int?
      s3_points            Int?
      s4_points            Int?
      s1_heading           Int?
      s2_heading           Int?
      s3_heading           Int?
      s4_heading           Int?
      website_click_points Int?
      email_lead_points    Int?
      grouping             String?
      campaign_header      String?
      campaign_thumb       String?
      web_click            Int?
      email_lead           String?
      password             String?
      a_or_b               String?
      sibling_id           String?  @default(cuid())
      h                    Int?
      createdAt            DateTime @default(now())
      updatedAt            DateTime @updatedAt
    }
    Error:
    Copy code
    32     const campaign = await prisma.campaign.create({
               data: {
                 campaign_name: 'This is Test Campaign',
                 campaign_type: 'Test type',
             +   campaign_details: String,
             +   campaign_budget: Int,
             +   point_value: Int,
             +   s1_points: Int,
             +   s2_points: Int,
             +   s3_points: Int,
             +   s4_points: Int,
             +   s1_heading: Int,
             +   s2_heading: Int,
             +   s3_heading: Int,
             +   s4_heading: Int,
             +   website_click_points: Int,
             +   email_lead_points: Int,
             +   grouping: String,
             +   campaign_header: String,
             +   campaign_thumb: String,
             +   web_click: Int,
             +   email_lead: String,
             +   password: String,
             +   a_or_b: String,
             +   h: Int,
             ?   owner_id?: String,
             ?   sponsor_id?: String,
             ?   sibling_id?: String,
             ?   createdAt?: DateTime,
             ?   updatedAt?: DateTime
               }
             })
    
    Argument campaign_details for data.campaign_details is missing.
    Argument campaign_budget for data.campaign_budget is missing.
    Argument point_value for data.point_value is missing.
    Argument s1_points for data.s1_points is missing.
    Argument s2_points for data.s2_points is missing.
    Argument s3_points for data.s3_points is missing.
    Argument s4_points for data.s4_points is missing.
    Argument s1_heading for data.s1_heading is missing.
    Argument s2_heading for data.s2_heading is missing.
    Argument s3_heading for data.s3_heading is missing.
    Argument s4_heading for data.s4_heading is missing.
    Argument website_click_points for data.website_click_points is missing.
    Argument email_lead_points for data.email_lead_points is missing.
    Argument grouping for data.grouping is missing.
    Argument campaign_header for data.campaign_header is missing.
    Argument campaign_thumb for data.campaign_thumb is missing.
    Argument web_click for data.web_click is missing.
    Argument email_lead for data.email_lead is missing.
    Argument password for data.password is missing.
    Argument a_or_b for data.a_or_b is missing.
    Argument h for data.h is missing.
    
    Note: Lines with + are required, lines with ? are optional.
  • n

    Nichita Z

    12/14/2021, 10:31 AM
    Hello! Any update on this one? Seems like a pretty severe bug to have in prod, and there doesn’t seem to be any fix other than rawQuery-ing it..
    m
    • 2
    • 1
  • s

    Slackbot

    12/14/2021, 11:27 AM
    This message was deleted.
    m
    • 2
    • 2
  • a

    Adrian

    12/14/2021, 11:41 AM
    What does "Unchecked" means in Prisma Types? Most of the types come with an Unchecked variant?
  • r

    Rune Jørgensen

    12/14/2021, 11:52 AM
    Anybody know how to change the indentation for the auto-formatter after the 3.6.0 release 🙂? Mine has been stuck at two spaces since I updated.
    a
    • 2
    • 2
  • u

    user

    12/14/2021, 1:05 PM
    GitHub Africa/GraphQL Berlin - Eli Perkins - "Unlocking Static Type Superpowers with GraphQL..."

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

    Ever wondered how that GraphQL definitions become static types in TypeScript or Swift? Curious how an HTTP request to a GraphQL server can end up returning a whole GraphQL schema? At GitHub, we’ve been exploring and shipping some unique new ways to leverage GraphQL introspection and put the static types and API contracts to good use. In this talk, we’ll dig into the nitty-gritty of GraphQL introspection and how you can use static types to build stellar products. Eli is a mobile engineer, working on GitHub for iOS. Eli has been working with iOS since 2010, has a passion for pixel perfection, and loves to teach computers to solve problems so that humans don’t have to. When he’s not writing Swift, GraphQL, or Ruby, you can probably find Eli brewing a coffee and hanging out with his chatty Siamese cat. Get in touch with Eli: https://twitter.com/_eliperkins Join our meetup groups: https://www.meetup.com/GitHub-Africa/ https://www.meetup.com/graphql-berlin/
  • r

    rdunk

    12/14/2021, 4:45 PM
    Does anyone have some good resources they could share for implementing AuthZ in a setup with Users and Teams? In my setup an Entity belongs to a Team, and a Team has many Users, but I’m not sure how I should validate whether a User has access to a given Entity through the Team they belong to, and if that logic should be handled in the resolver or somewhere else
    m
    • 2
    • 9
  • d

    Dev__

    12/14/2021, 5:05 PM
    when using a create
    .create
    it seems that I cannot use the following combination
    Copy code
    .create({
        relationAId: id,
        relationBId: {
            connectOrCreate: ...
        }
    })
    any reason why this isnt made possible?. TS gives me an error
    m
    • 2
    • 2
  • m

    Matt Matheson

    12/14/2021, 5:49 PM
    Is there a way to validate foreign keys during a findMany invocation without
    include
    ? Imagining I have users with posts:
    Copy code
    const posts = await prisma.post.findMany({
         where: {
             userId,
        } 
      });
    will return 0 whether a user with the given id exists. I'd like to differentiate between "no posts for this user" and "this user doesn't exist".
  • y

    Yaakov

    12/14/2021, 8:31 PM
    With Prisma's current lack of rollbacks, is there a suggested method of handling this in production?
    f
    g
    d
    • 4
    • 8
  • z

    Zach

    12/14/2021, 8:42 PM
    Hello 👋🏼 I am new to databases. What should I familiarize myself with before jumping into Prisma?
    m
    • 2
    • 2
  • γ

    Γιώργος Κραχτόπουλος

    12/14/2021, 9:18 PM
    How can I get "full" model types with relations included? Or, is there a way to get all the relations field names in an array?
    🙌 1
  • o

    oof2win2

    12/14/2021, 9:19 PM
    hey there. is there any reason as to why i can't get the createMany function at all on my sqlite connection? changing data source to
    mysql
    adds the methods in
    m
    • 2
    • 1
  • s

    Secre

    12/14/2021, 10:46 PM
    Hello! 👋🏻 I have some questions about relations...
    j
    • 2
    • 6
  • s

    Stefan Bajić

    12/14/2021, 11:24 PM
    I have an issue deploying to AWS Elastic Beanstalk. The error is the same as described here https://www.prisma.io/docs/guides/deployment/deployment-guides/caveats-when-deploying-to-aws-platforms#error-prismaclient-did-not-initialize-yet but moving the prisma package to dependencies didn’t solve it for me. Does anyone know what I can do to further debug this?
    • 1
    • 3
  • b

    Brian de la Motte

    12/15/2021, 4:28 AM
    Hello, We have an API call that needs to fetch a database entry, get a column, and append to that column. The datatype is JSON so we are adding an object to a JSON array and saving it back to the that row. We do that in two steps: prisma.findUnique and prisma.update. The problem occurs where the API is called back to back and findUnique grabs the same data twice and then only one value is saved and the other seems to get overwritten. We thought wrapping this in a transaction would fix the issue, but it still happens. Throwing a random sleep in the API call so that the prisma calls are spread out by a few milliseconds fixes the issue but feels like a hack. Essentially this is what seems to happen: API call 1 - Gets JSON data - currently length 1 API call 2 - Gets JSON data - currently length 1 API call 1 - Saves JSON data - currently length 2 API call 2 - Overwrites JSON data - currently length 2 Expected behavior in a transaction API call 1 - Gets JSON data - currently length 1 API call 1 - Saves JSON data - currently length 2 API call 2 - Gets JSON data - currently length 2 API call 2 - Save JSON data - currently length 3 Any ideas to solve this without using a setTimer() to space the API calls out and thus the prisma calls, would be greatly appreciated.
  • a

    Adrian

    12/15/2021, 8:07 AM
    Any plans of making create, createMany and connect implicit? It adds a lot of extra noice to the code compare to TypeORM
  • f

    Fishie

    12/15/2021, 10:35 AM
    could anyone help me with this error? I'm really confused
    n
    • 2
    • 4
  • f

    Fishie

    12/15/2021, 11:46 AM
    😳 uh oh
    • 1
    • 1
  • u

    user

    12/15/2021, 2:20 PM
    Type-safe JavaScript with JsDoc JsDoc is a great tool for documenting code and providing type-safety in your JavaScript project without any additional configuration. Learn what JsDoc is, how it works, the benefits it provides, and how to use it in your project.
  • j

    Julien Goux

    12/15/2021, 3:59 PM
    Hello all
  • j

    Julien Goux

    12/15/2021, 3:59 PM
    can anyone install prisma right now?
  • j

    Julien Goux

    12/15/2021, 4:00 PM
    We get errors from npm registry, I’m not sure if it’s related to AWS issues right now 😅
    m
    • 2
    • 3
  • j

    Julien Goux

    12/15/2021, 4:00 PM
    I thought npm was on azure
  • r

    rdunk

    12/15/2021, 4:01 PM
    Think some CDN must be having a major issue. Slack, npm, loads of websites all having problems.
  • r

    rdunk

    12/15/2021, 7:22 PM
    Is there a way to use
    updateMany
    to update multiple different records at once? For example I have an array
    [{ id: 1, name: 'Foo' }, { id: 2, name: 'Bar' }]
    that I want to change to
    [{ id: 1, name: 'FOO' }, { id: 2, name: 'BAR' }]
    . Or is
    updateMany
    only used to update records to all have the same given value?
    m
    • 2
    • 2
  • r

    rdunk

    12/15/2021, 7:30 PM
    I’d assumed I could do something like
    Copy code
    prisma.entity.updateMany([
      {
        where: {
          id: 1,
        },
        data: {
          name: 'FOO'
        }
      },
      {
        where: {
          id: 2,
        },
        data: {
          name: 'BAR'
        }
      },
    ])
  • d

    Drew Turnblad

    12/16/2021, 12:24 AM
    If I introspect postgres check constraints into prisma, they’re not added to the prisma schema, but will they still be reflected whenever a new prisma migration is run in a different env?
  • j

    Jordan Vohwinkel

    12/16/2021, 2:32 AM
    I have the following select query
    Copy code
    const select = {
            id: true,
            firstName: true,
            middleName: true,
            lastName: true,
            email: true,
            userGroups: {
              select: {
                groupId: true,
                userId: true,
                group: {
                  select: {
                    id: true,
                    name: true,
                    isActive: true
                  },
                  where: {
                    id: 1
                  }
                }
              },
              where: {
                groupId: 1
              }
            }
          }
    client.findMany({ select });
    the where clause on “userGroups: works perfect, the where clause on “group” does not. error: Unknown arg
    where
    in select.userGroups.select.group.where for type group. Did you mean
    select
    ? Available args:type group {} Is there a nesting limit?
1...521522523...637Latest