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

    Austin Zentz

    05/05/2022, 5:42 PM
    Hey, I got my first Prisma bug report (filed in September) closed out along with a bunch of related ones in Github. Thanks, Prisma team!!
    prisma rainbow 3
    šŸ™Œ 1
    v
    • 2
    • 1
  • s

    Slackbot

    05/05/2022, 7:13 PM
    This message was deleted.
    n
    • 2
    • 2
  • e

    Eric Simon

    05/05/2022, 8:27 PM
    Hello! I am new to Prisma and trying to figure out how to use Postgis extensions with my prisma schema. How do I tell Prisma to ignore a set of views of tables? I get the following error when I run a migrate:
    Copy code
    Error: P3016
    
    The fallback method for database resets failed, meaning Migrate could not clean up the database entirely. Original error: 
    db error: ERROR: cannot drop view geography_columns because extension postgis requires it
    HINT: You can drop extension postgis instead.
       0: sql_migration_connector::best_effort_reset
                 at migration-engine/connectors/sql-migration-connector/src/lib.rs:290
       1: migration_core::state::DevDiagnostic
                 at migration-engine/core/src/state.rs:250
    My prisma version is:
    Copy code
    => prisma --version
    prisma                  : 3.13.0
    @prisma/client          : Not found
    Current platform        : darwin
    Query Engine (Node-API) : libquery-engine efdf9b1183dddfd4258cd181a72125755215ab7b (at ../../../../../usr/local/lib/node_modules/prisma/node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
    Migration Engine        : migration-engine-cli efdf9b1183dddfd4258cd181a72125755215ab7b (at ../../../../../usr/local/lib/node_modules/prisma/node_modules/@prisma/engines/migration-engine-darwin)
    Introspection Engine    : introspection-core efdf9b1183dddfd4258cd181a72125755215ab7b (at ../../../../../usr/local/lib/node_modules/prisma/node_modules/@prisma/engines/introspection-engine-darwin)
    Format Binary           : prisma-fmt efdf9b1183dddfd4258cd181a72125755215ab7b (at ../../../../../usr/local/lib/node_modules/prisma/node_modules/@prisma/engines/prisma-fmt-darwin)
    Default Engines Hash    : efdf9b1183dddfd4258cd181a72125755215ab7b
    Studio                  : 0.459.0
    n
    • 2
    • 1
  • d

    Dev__

    05/06/2022, 9:36 AM
    is there an interface available within
    prisma
    that defined the
    $transaction
    prisma type? I have instances where I want to pass the transaction's prisma as an arg
    n
    • 2
    • 1
  • h

    Hugo Vallejo

    05/06/2022, 3:30 PM
    Does anybody actually help here?
    n
    • 2
    • 25
  • h

    Hugo Vallejo

    05/06/2022, 3:31 PM
    I never received an answer
  • s

    shahrukh ahmed

    05/06/2022, 3:40 PM
    What's the best approach to get an object/s by the month they were created. Like get all the object for the month of may and year 2022.
    n
    • 2
    • 8
  • n

    Nic Luciano

    05/06/2022, 5:21 PM
    how can i reliably get a delegate name from a model name in my custom generator? given model name
    UserThing
    i want
    userThing
    . i can just camelcase-and-pray for now, but i was hoping there was a more coupled-to-Prisma way to get the delegate name? i don't see it in the dmmf document or
    options
    . (which makes sense, because i guess it's more owned by the js client generator than the schema tools...)
    n
    • 2
    • 1
  • c

    Carlos Gomez

    05/06/2022, 6:27 PM
    What prompts Prisma to ask a user to
    Please enter a name for the new migration:
    when after all migrations have been run for an application and it starts to boot?
    āœ… 1
    n
    • 2
    • 2
  • w

    Wesley

    05/06/2022, 8:17 PM
    Hi from Reunion island
  • w

    Wesley

    05/06/2022, 8:18 PM
    I just know Javascript, node.js, never used react, do you think I can follow the tutorial howtographql.com ?
    n
    n
    • 3
    • 3
  • w

    Wesley

    05/06/2022, 8:18 PM
    I'm not a developer, just a sysadmin
  • w

    Wesley

    05/06/2022, 8:20 PM
    What are the requirements ?
  • j

    James Kienle

    05/07/2022, 6:12 AM
    Hey all! Running into a pretty strange error and can't seem to find anyone with a similar issue online. I have a monorepo with a structure similar to this • apps ā—¦ my-nextjs-app • packages ā—¦ some-prisma-helper This monorepo uses pnpm 7 and the latest version of turborepo. When I launch my nextjs app after running
    pnpm exec prisma generate
    I see the following It looks like prisma isn't resolving properly? I'm honestly not sure and at a bit of a loss for what to do from here šŸ˜…
    n
    • 2
    • 1
  • j

    James Kienle

    05/07/2022, 6:13 AM
    One other thing to note,
    @prisma/client
    is a devdependency and peerdependency of
    packages/some-prisma-helper
    and a dependency of
    apps/my-nextjs-app
    , so I'd think the resolution would come from the nextjs app, but I could be wrong
    n
    • 2
    • 1
  • b

    Boo

    05/07/2022, 6:22 AM
    in a relation, can you reference another scalar id on another table? or can it only be the
    id
    PK of the table. like on the table if you have
    Copy code
    postId BigInt @map("post_id")
    
    @@id([id, postId])
    can i reference this
    postId
    on a relation?
    n
    • 2
    • 1
  • u

    user

    05/07/2022, 8:00 AM
    šŸ‘‰ Rust and Tell Berlin Meetup - Arend van Beelen - Full-stack WASM development with fp-bindgen --

    https://www.youtube.com/watch?v=T7E_sj4MjDIā–¾

    -- This talk has been recorded at the Rust and Tell Berlin Meetup at the Prisma office on April 12 2022. Join our meetup group: https://www.meetup.com/Rust-Berlin/
    prisma rainbow 2
  • b

    Boo

    05/07/2022, 3:54 PM
    is there a way to make this work? Relationship between
    authorId
    and
    followingId
    ?
    Copy code
    model Users {
      id BigInt @id @default(autoincrement())
    
      followers  Follows[] @relation("follower")
      followings Follows[] @relation("following")
    
      posts          Posts[]
    
      createdOn DateTime @default(now()) @map("created_on")
      updatedOn DateTime @updatedAt @map("updated_on")
    
      @@map("users")
    }
    
    // Following users can have many posts
    model Follows {
      id BigInt @default(autoincrement())
    
      followerId  BigInt @map("follower_id")
      followingId BigInt @map("following_id")
    
      follower  Users @relation("following", fields: [followerId], references: [id])
      following Users @relation("follower", fields: [followingId], references: [id])
    
      followingPosts Posts[]
    
      createdAt DateTime @default(now()) @map("created_at")
      updatedAt DateTime @default(now()) @map("updated_at")
      @@id([id, followerId, followingId])
      @@map("follows")
    }
    
    // Posts will always have an authorId
    model Posts {
      id     BigInt  @default(autoincrement())
     
      authorId BigInt @map("author_id")
      author   Users  @relation(fields: [authorId], references: [id])
    
      follows Follows @relation(fields: [authorId], references: [followerId])
    
      createdAt DateTime @default(now()) @map("created_at")
      updatedAt DateTime @default(now()) @map("updated_at")
      @@id([id, authorId])
      @@map("bits")
    }
    
    // Query should work like this 
    
    users.findMany({
      where: {
        id: 1
      },
      include: {
        followings: { // all posts of the users that I follow
          include: {
            posts: true
          }
        }
      }
    })
    n
    • 2
    • 1
  • u

    user

    05/08/2022, 8:00 AM
    šŸ‘‰ Rust and Tell Berlin - Simon Hausmann - Graphical UIs with Rust and Slint on a Pico Microcontroller --

    https://www.youtube.com/watch?v=SDmZoE3os0Yā–¾

    -- This talk was recorded at the Rust and Tell Berlin Meetup at the Prisma office on April 12, 2022. Join our meetup group: https://www.meetup.com/Rust-Berlin/
    prisma rainbow 2
  • s

    Sunal Orhon

    05/08/2022, 4:54 PM
    Hello I am using new prisma and I don't understand my terminal write to this message "prisma:query". I did not find a way the message to close and my all query show the message.
    n
    • 2
    • 2
  • m

    Moin Akhter

    05/08/2022, 7:48 PM
    Hey guys, I'm using graphql-yoga and for validation i'm using joi but when throw back error i'm not able to get error object in response.My code for throwing error is like this: const { GraphQLYogaError } = require("graphql-yoga"); const schema = Joi.object({ name: Joi.string().empty().messages({ "string.empty":
    Please provide user name
    , }), email: Joi.string().empty().email().messages({ "string.empty":
    Please provide email
    , "string.email":
    Please provide valid email
    , }), password: Joi.string().empty().min(8).messages({ "string.empty":
    Please provide password
    , "string.min":
    Password must be atleast 8 character long
    , }), }); const { error, value } = schema.validate(args.data, { abortEarly: false, }); const { haveErrors, errors } = createObject(value, error); if (haveErrors) { throw new GraphQLYogaError(JSON.stringify(errors)); } But i'm not getting error object. Plz help if anyone have idea. Thanks in advance
    n
    • 2
    • 5
  • b

    Benjamin Indermühle

    05/09/2022, 6:25 AM
    I’ve found a small issue in the documentation. Should I create a bug report on the main repo or is the documentation tracked somewhere else? https://www.prisma.io/docs/concepts/database-connectors/postgresql#connecting-via-sockets in the query string POST should be PASSWORD
    j
    n
    • 3
    • 3
  • u

    user

    05/09/2022, 8:01 AM
    šŸ‘‰ Rust and Tell Berlin - Bartosz Sypytkowski - Rich collaborative data structures for everyone --

    https://www.youtube.com/watch?v=wCsxI9CwmS4ā–¾

    -- This talk was recorded at the Rust and Tell Berlin Meetup at the Prisma office on April 12, 2022. Join our meetup group: https://www.meetup.com/Rust-Berlin/ Connect with Bartosz: https://bartoszsypytkowski.com/
    prisma rainbow 2
  • k

    Kay Khan

    05/09/2022, 9:29 AM
    Hi friends im having an issue where my query hangs, any idea how i can debug this
    Copy code
    const brands = await PrismaService.brand.findMany({
                distinct: ["name"],
                select: {
                    id: true,
                    name: true,
                    image: {
                        select: {
                            source: true,
                            dtype: true,
                        },
                    },
                },
            });
    Copy code
    prisma:info Starting a mysql pool with 9 connections.
    prisma:query SELECT `checkpoint_gg`.`brand`.`id`, `checkpoint_gg`.`brand`.`name`, `checkpoint_gg`.`brand`.`image_id` FROM `checkpoint_gg`.`brand` WHERE 1=1
    Seems like it does not like joining on that image table any idea why?
    n
    • 2
    • 37
  • d

    Daniell

    05/09/2022, 9:38 AM
    Hi! I'm trying to gradually upgrade from Prisma 1 to 2 but I'm facing this error: → npx prisma init Error: We detected a Prisma 1 project. For Prisma 1, please use the
    prisma1
    CLI instead. You can install it with
    npm install -g prisma1
    . If you want to upgrade to Prisma 2+, please have a look at our upgrade guide: http://pris.ly/d/upgrading-to-prisma2 at this step: https://www.prisma.io/docs/guides/upgrade-guides/upgrade-from-prisma-1/upgrading-the-prisma-layer-mysql#2-create-your-prisma-2-schema
    n
    a
    m
    • 4
    • 25
  • m

    Matt

    05/09/2022, 2:57 PM
    Hi folks, apologies if this is not the correct forum for questions, but I did not want to raise an issue if it's unrelated to Prisma. I've had Prisma running for a week now against Aurora Serverless V2 (_8.0.mysql_aurora.3.02.0_). However, I'm noticing my logs are getting spammed with the following, and I've no idea why this might be.
    Copy code
    2022-05-09T12:25:07.783788Z 1568 [Note] [MY-010914] [Server] Aborted connection 1568 to db: 'xxxxxx' user: 'xxxxxxx' host: 'xx.xx.xx.xx' (Got an error reading communication packets). (<http://sql_connect.cc:835|sql_connect.cc:835>)
    j
    n
    • 3
    • 9
  • h

    Hussam Khatib

    05/09/2022, 5:39 PM
    Consider the below code
    Copy code
    const getUser = await prisma.user.findUnique({
      where: {
        id: 19,
      },
      select: {
        posts: {
          select: {
            title: true,
          },
        },
      },
    })
    output
    Copy code
    {
      posts: { title: 'My first post' }
    }
    Is there a way to get it like the one shown below ?
    Copy code
    {
      posts: "My post title"
    }
    āœ… 1
    a
    • 2
    • 1
  • s

    Slackbot

    05/09/2022, 11:32 PM
    This message was deleted.
    n
    • 2
    • 1
  • y

    Yaakov

    05/10/2022, 12:04 AM
    How can I disconnect via explicit many-to-many using a where clause? The following is not working:
    Copy code
    await prisma.user.update({
      where: { id: 1 },
      data: {
        userRoles: {
          deleteMany: {
            where: {
              role: {
                type: 'SOME_ROLE',
              },
            },
          },
        },
      },
    })
    n
    • 2
    • 6
  • p

    PanMan

    05/10/2022, 7:54 AM
    I have an upsert fail:
    Copy code
    Unique constraint failed on the constraint: `stats_company_id_day_stat_type_context_key`
    Isn’t the idea of the upsert it doesn’t fail but does the update, then?? I’m doing:
    Copy code
    prisma.stats.upsert({
          create: stat,
          update: stat,
          where: {
            company_id_day_stat_type_context: {
              company_id: companyId,
              day: stat.day,
              context: stat.context || "",
              stat_type: stat.stat_type,
            },
          },
        });
    n
    • 2
    • 14
1...571572573...637Latest