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

    Wingy

    11/06/2021, 5:04 PM
    is there any plan for CHECK in schema definitions?
  • w

    Wingy

    11/06/2021, 5:05 PM
    wasn't able to find anything in the GH issues after a few searches but there might be one
    r
    • 2
    • 1
  • y

    Yehonatan Levi

    11/06/2021, 5:29 PM
    i am not sure i get it but if i want to access prisma from the client i still need to build a server and still need to write graphql schema?
  • r

    Ryan Rhodes

    11/06/2021, 11:27 PM
    Hi, I am trying to understand best practices when it comes verifying if an individual user has access to a specific piece of data? My thought process is to add a filter that compares the user coming from an Authorization header to the userId associated with a row in a table, but I can’t seem to apply this logic when using most queries where I want 1 result. If anyone has tips on how to approach this, it would be greatly appreciated.
    r
    • 2
    • 5
  • l

    Lucas

    11/07/2021, 6:22 AM
    Is anyone using graphql
    nexus
    in production? Does the prisma team/company helps to maintain it? I am trying to figure out if it's a good option to use in production as we have a lot of issues on the repo plus old commits? Trying to achieve a code first approach but don't want to use
    type-graphql
    as the code depends heavily on decorators, etc and a more declarative way would be easier to understand/maintain. Also what are you guys using in production? I have developed several projects writing plain SDL and then using graphql code generator to create types, etc. I already used plain graphql.js with graphql-code-generator to create resolver types and then implement it separated using the generated types and it was great, but I am about to start a new project and thinking to go 100% with a code first approach. Thanks
    j
    r
    • 3
    • 3
  • g

    Gheorghe

    11/07/2021, 7:06 AM
    Hello everyone, While doing some tests unit tests, trying to create a record with missing information on a required field, I get a ‘PrismaClientValidationError’ object, with ‘message’ filled properly,  but no ‘code’ ? According to the error page list the should be an code for this kind of error: => https://www.prisma.io/docs/reference/api-reference/error-reference Does anyone encountered this behaviour in the past ? Thank you ! Context: MacOS BigSur 11.6 “Prisma”: “^3.4.0"
  • a

    Adam Vaughn

    11/07/2021, 6:30 PM
    👋 Hello, everyone!
    fast parrot 1
    👋 1
  • n

    Noel Martin Llevares

    11/07/2021, 9:54 PM
    Has anyone have a good solution for dockerizing a Prisma backend? Due to Prisma having both a devDependency (
    prisma
    ) and a dependency (
    @prisma/client
    ), it feels like I have to fight my way against Prisma defaults. I want to make sure my container only has prod dependencies but doing a
    yarn install --production
    will fail because
    @prisma/client
    requires
    prisma
    .
    r
    • 2
    • 2
  • c

    Carlos

    11/08/2021, 1:01 AM
    Hello everyone, Has anyone been able to perform a prisma migrate deploy from AWS Lambda, AWS Fargate or AWS ECS Container? I was following this thread on Github https://github.com/prisma/prisma/issues/4703 however there doesn't seem to be a conclusion. The main problem is that lambdas are read-only so you cannot execute prisma migrate deploy successfully as it requires to write a couple of things. I don't really need to execute this on NodeJS, I just need to be able to instruct prisma to perform a deploy with a specific Connection URL to create new customer tenants in Postgresql (Each tenant is a schema) and await for it to confirm that the schema was created. This process should not take more than 5 seconds as the database is pretty small. I don't use EC2 instance, so I appreciate if any recommendation doesn't include virtual machines or EC2 instances.
    ✅ 1
    d
    • 2
    • 19
  • j

    Jordansz

    11/08/2021, 1:17 PM
    hello everyone just a newbie question. but where does prisma store database in postrgres database? in public => tables there are no tables
    r
    • 2
    • 24
  • a

    Anton Reindl

    11/08/2021, 1:54 PM
    Hi! ⛑️ Did anyone ever use Prisma with Google App Engine (GAE)? I am facing the
    @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
    problem - and tried different custom build commands. So far without any luck. Link to discussion: https://github.com/prisma/prisma/discussions/10156 🧐 any hints appreciated
  • j

    joao.santos

    11/08/2021, 2:42 PM
    Hi guys, i've been searching for a solution but i cant get logs to work in prisma client, i wanted to see the sql that was generated, can someone help me? yhx
    r
    m
    • 3
    • 14
  • o

    Onur Ünal

    11/08/2021, 5:46 PM
    Hello all, are there any learning courses, ebooks or tutorials on prisma? I could not find any on udemy. Thanks
    r
    • 2
    • 2
  • j

    Jesus Jimenez

    11/08/2021, 8:30 PM
    Hi people, I hope this is the right place to ask this question. Is there any reason why the prisma client wouldn't give me access to a model I've declared in the prisma schema? I have 3 models in the schema (user, movie, entry), and in nest I can access the movie model by injecting the client into the service and calling
    this.prisma.movie...
    . The weird thing is that I did exactly the same thing as I did with the movies service with the other two, but I can only access the movie model. I would really appreciate if anyone can help, I've been going a bit crazy over this :D
    r
    • 2
    • 13
  • m

    martin

    11/08/2021, 11:28 PM
    Running into issues connecting with Prisma to PlanetScale. Anyone else? Is this a known outage?
    Copy code
    Secure connection to database my_database and branch dev is established!.
    
    Local address to connect your application: 127.0.0.1:3306 (press ctrl-c to quit)
    Prisma schema loaded from prisma/dev/schema.prisma
    Datasource "db": MySQL database "my_database" at "localhost:3306"
    
    Error: P1017: Server has closed the connection.
    Error: running command with --execute has failed: exit status 1
    t
    • 2
    • 3
  • m

    martin

    11/08/2021, 11:28 PM
    https://github.com/prisma/prisma/issues/10169
  • m

    martin

    11/08/2021, 11:36 PM
    Just resolved itself. Not sure why (guessing it was an outage). On both (independent) SaaS projects / databases.
    👍 1
  • s

    Slackbot

    11/09/2021, 2:36 AM
    This message was deleted.
    r
    m
    • 3
    • 4
  • g

    genedy

    11/09/2021, 3:02 AM
    I have a question this query is working in pgadmin however it doesn't work in prisma.$queryRaw
    Copy code
    const queryCompanies = await prisma.$queryRaw`SELECT * FROM "Company" where "name" like '%${searchName}%' and "companyId" in (SELECT "company_id" FROM "staff" where "userId"=${user.user_id} ) OFFSET ${iSkip} ROWS FETCH NEXT ${limit} ROWS ONLY  ; `
    I am searching by searchName
    r
    • 2
    • 21
  • j

    Jonathan Selander

    11/09/2021, 9:12 AM
    so how do people deploy apps that depend on migrations safely? without downtime?
  • l

    Lars Ivar Igesund

    11/09/2021, 9:34 AM
    Did anyone try AsyncLocalStorage (from e.g. node 16) for storing prisma client and other context? This will simplify a lot of stuff in our code, but not entirely sure of how stable it is.
  • k

    Kaushik Agrawal

    11/09/2021, 12:15 PM
    Hello I am Kaushik Agrawal from Ahmedabad, Gujrat, India.
  • k

    Kaushik Agrawal

    11/09/2021, 12:17 PM
    I haven't saved my ticket for conf. . Now I want to post it on LinkedIn. How can I get it?
    r
    • 2
    • 4
  • s

    Slackbot

    11/09/2021, 1:57 PM
    This message was deleted.
    r
    i
    • 3
    • 2
  • r

    Reuben Porter

    11/09/2021, 2:53 PM
    Hi @Ryan, do you know when there will be support to return all new records after a
    createMany
    ?
  • e

    ezeikel

    11/09/2021, 3:35 PM
    Hey all 👋 I was trying to allow a user to upload multiple images/video aka media so wanted to use
    createMany
    but also wanted to create new records in the
    contributions
    table to record which user uploaded the media. I noticed trying to use
    create
    for the nested relation doesn't work as it does in other cases. And I think these docs are saying that you can't access relations inside of a
    createMany
    - https://www.prisma.io/docs/concepts/components/prisma-client/relation-queries#create-multiple-records-and-multiple-related-records So my question is what would the alternative/workaround way to do this?
    Copy code
    createMany: {
                data:
                  processedMedia?.map(singleProcessedMedia => ({
                    ...singleProcessedMedia,
                    contribution: {
                      create: {
                        type: "MEDIA",
                        user: {
                          connect: {
                            id: userId,
                          },
                        },
                      },
                    },
                  })) || [],
              },
    s
    • 2
    • 3
  • n

    Noel Martin Llevares

    11/09/2021, 4:25 PM
    I’m getting an error when running
    prisma generate
    from inside my docker container. Keeps complaining that
    libquery_engine-debian-openssl-1.1.x.so.node
    is missing even though it is definitely there.
    Copy code
    $ yarn generate
    yarn run v1.22.15
    $ prisma generate
    Prisma schema loaded from prisma/schema.prisma
    Error: Unable to require(`/opt/node_app/node_modules/prisma/libquery_engine-debian-openssl-1.1.x.so.node`)
     libssl.so.1.1: cannot open shared object file: No such file or directory
    error Command failed with exit code 1.
    info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.
    $ ls -la
    total 304
    drwxr-xr-x   1 node node   4096 Nov  9 15:54 .
    drwxr-xr-x   1 root root   4096 Nov  9 15:32 ..
    drwxr-xr-x   2 node node   4096 Nov  9 15:54 cli
    drwxr-xr-x 587 node node  20480 Nov  9 15:54 node_modules
    -rw-r--r--   1 node node   2386 Nov  9 02:28 package.json
    drwxr-xr-x   3 node node   4096 Nov  9 15:51 prisma
    drwxr-xr-x   6 node node   4096 Nov  9 15:54 src
    -rw-r--r--   1 node node    537 Nov  9 02:48 tsconfig.json
    -rw-r--r--   1 node node 256177 Nov  9 02:28 yarn.lock
    $ cd node_modules/prisma
    $ ls -la
    total 39896
    drwxr-xr-x   7 node node     4096 Nov  9 15:54 .
    drwxr-xr-x 587 node node    20480 Nov  9 15:54 ..
    -rw-r--r--   1 node node    11357 Nov  9 15:52 LICENSE
    -rw-r--r--   1 node node     1849 Nov  9 15:52 README.md
    drwxr-xr-x   4 node node     4096 Nov  9 15:53 build
    drwxr-xr-x   3 node node     4096 Nov  9 15:53 install
    -rwxr-xr-x   1 node node 40784096 Nov  9 15:54 libquery_engine-debian-openssl-1.1.x.so.node
    -rw-r--r--   1 node node     3905 Nov  9 15:52 package.json
    drwxr-xr-x   3 node node     4096 Nov  9 15:53 preinstall
    drwxr-xr-x   5 node node     4096 Nov  9 15:53 prisma-client
    drwxr-xr-x   2 node node     4096 Nov  9 15:53 scripts
    $ pwd
    /opt/node_app/node_modules/prisma
    $
    r
    • 2
    • 8
  • c

    Chris Tsongas

    11/09/2021, 7:10 PM
    Looking for advice on how to manage updating relations. I'd like to be able to update relations in one operation, i.e. updating the categories of a product. Currently in the docs I see how to connect or disconnect relations, here is the example in the docs:
    Copy code
    const getUser = await prisma.user.update({
      where: {
        id: 9
      },
      data: {
        posts: {
          connect: {
            id: 11
          },
          create: {
            title: "My new post title"
          }
        }
      }
    })
    Unfortunately, I don't believe this will disconnect previously related posts i.e. a post with an
    id
    of
    5
    that should no longer be related to this user. This means that (in this example) when the API receives an array of post IDs that should be related to this user, I first have to query which posts are currently related to the user, then run another query to connect new posts, and yet another query to disconnect old posts. Think about a situation where on the front end, someone can edit a product and assign it to zero or more categories via a multi-select. Same problem. Seems unfortunate there's no way to update a many-to-many relation in one operation, or maybe I've missed it? I know you can connect an array of IDs, but again I'm guessing that won't disconnect IDs that aren't in the array, or all IDs if the array is empty.
    ✅ 1
    m
    • 2
    • 2
  • e

    Edward Baer

    11/09/2021, 10:08 PM
    @janpio I have updated the issue with corrections in the example code for you: https://github.com/prisma/prisma/issues/9868
    j
    • 2
    • 1
  • s

    Simoh 2k

    11/09/2021, 10:56 PM
    Hello i have this error, i want to get a user with specific role Id but i don't understand why i have this Controller :
    Copy code
    @Get('getCoiffeurs')
    async getCoiffeurs(@Param('roleId') roleId: string): Promise<User> {
      return await this.usersService.findAllCoiffeurs({ roleId: roleId });
    }
    Service :
    Copy code
    async findAllCoiffeurs(
      userWhereUniqueInput: Prisma.UserWhereUniqueInput,
    ): Promise<User | null> {
      return this.prismaService.user.findUnique({
        where: {
          roleId: userWhereUniqueInput?.roleId,
        },
      });
    }
    r
    • 2
    • 2
1...504505506...637Latest