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

    Ramón Morcillo

    01/13/2021, 7:47 PM
    Hi there, i was trying Prisma and as a first impression after following the Quickstart I find it pretty awesome, so congrats and thank you for the work! 😊 I tried the example https://github.com/prisma/prisma-examples/tree/latest/typescript/graphql-nextjs later and following the
    README.md
    file I found some issues when I reach the
    Profile
    part. I explained them better in this issue https://github.com/prisma/prisma-examples/issues/2417 to see if someone could lend me a hand with them. I am posting it here just in case someone can help me faster or has any idea. By the way, sorry if this is not the proper channel for this kind of messages, if there is a more appropriate one please tell me and I would gladly post it there 😊
    n
    • 2
    • 2
  • j

    Jonathan

    01/13/2021, 11:07 PM
    I once asked this question, but I would be curious to ask it again. In current CI/CD workflows (for example, deploying a docker container to AWS), I am always curious where in their process people include the actual migrations of the table. • Is this in the same docker image as where you serve the API from? The caveat is that you would have to include prisma/cli as dependency in your docker image only for migration-time (which might make the image much heavier)? • Do you use a separate image purely for the migration? And if so, when do you deploy this image?
    r
    d
    • 3
    • 28
  • b

    Ben Liger

    01/14/2021, 1:14 PM
    I am currently going through the upgrade from Prisma1 to Prsima2 detailed here: https://www.prisma.io/docs/guides/upgrade-guides/upgrade-from-prisma-1/upgrading-the-prisma-layer-postgres and I am stuck on the part where I have to run the SQL queries (part 5). I have run the command
    npx prisma-upgrade prisma1/prisma.yml prisma/schema.prisma
    and have been given some SQL queries to run
    Copy code
    ALTER TABLE "my-app-dev$dev"."Answer" ALTER COLUMN "id" SET DATA TYPE character varying(30);
    ALTER TABLE "my-app-dev$dev"."Answer" ALTER COLUMN "createdForQuestion" SET DATA TYPE character varying(30);
    ...
    I have executed these queries in several different DB clients and every time I re-run
    npx prisma-upgrade prisma1/prisma.yml prisma/schema.prisma
    it still prints me the same SQL queries that I have to run. I have checked the varchar length in my tables after running the scripts and they seem to show the correct value (30). Shall I assume this is a bug and continue on from here? Or does this mean something is still not correct with the schema?e
    n
    • 2
    • 5
  • y

    Yassine

    01/14/2021, 9:58 PM
    Hey, how can i run prisma migrate programmatically when deploying to heroku, right now i have to run the heroku console from the web app, and run
    npx prisma migrate
    , i'm building everything in docker.
    r
    s
    • 3
    • 8
  • g

    glenn

    01/14/2021, 10:00 PM
    If I'm trying to search a text[] column, do I want to use something like column_name: { contains: [search_text]} in the where clause?
    r
    • 2
    • 2
  • a

    Alex Reyne

    01/15/2021, 7:51 PM
    I'm having an issue with connectOrCreate - specifically, this:
    Copy code
    (node:15954) UnhandledPromiseRejectionWarning: Error:
    Invalid `prisma.runs.create()` invocation in
    /mnt/c/Users/me/wd/helios/commands/functions/sale.js:56:38
    
       52 }
       53
       54
       55 async function insertRun(msg, obj) {
    →  56     const newRun = await prisma.runs.create(
      Error occurred during query execution:
    EnvVarNotFound("Expected parent binding \'2\' to be present.")
        at qw.request (/mnt/c/Users/me/wd/helios/node_modules/@prisma/client/runtime/index.js:210:203)
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
        at async insertRun (/mnt/c/Users/me/wd/helios/commands/functions/sale.js:56:20)
    However, the only thing that has a value of 2 isn't it - I've changed it multiple times, still returns the error with 2.
  • a

    Alex Reyne

    01/16/2021, 7:15 PM
    Are you able to have a Connect inside of a ConnectOrCreate?
  • a

    Alex Reyne

    01/16/2021, 7:16 PM
    Copy code
    Users_Runs_ad_idToUsers: {
                    connectOrCreate: {
                        where: { discord: obj.ad.id },
                        create: { 
                            Servers: {
                                connect: { server_id: await getServer(obj.ad.nickname) }
                            },
                            discord: obj.ad.id,
                            payout_char: obj.ad.nickname,
                            balance: 0,
                            Ranks: {
                                connect: { id: 4 }
                            }
                        }
                    }
                }
    Something like this
    r
    • 2
    • 7
  • v

    Victor Björklund

    01/16/2021, 10:05 PM
    I’m having some issues with doing a many-to-many inside a graphql resolver. I got this prisma schema: pretty much users can belong to several orgs and orgs can contain several users.
  • v

    Victor Björklund

    01/16/2021, 10:05 PM
    And schema for graphql (using graphql tools)
  • v

    Victor Björklund

    01/16/2021, 10:07 PM
    The issue is that in my resolver for users. If I include organizations like this:
  • v

    Victor Björklund

    01/16/2021, 10:08 PM
    And then resolve orgs by returning that part:
  • v

    Victor Björklund

    01/16/2021, 10:08 PM
    it works when client is requesting organizations on the query. Something like this: query { users { id email organizations { name } } }
  • v

    Victor Björklund

    01/16/2021, 10:09 PM
    Then prisma makes 3 queries to the database
  • v

    Victor Björklund

    01/16/2021, 10:09 PM
    The issue is that if the client only requests user info and not nested info about organizations
  • v

    Victor Björklund

    01/16/2021, 10:09 PM
    then prisma still does all 3 queries even if it is not needed
  • v

    Victor Björklund

    01/16/2021, 10:10 PM
    it would be enough with just 1 query
  • v

    Victor Björklund

    01/16/2021, 10:10 PM
    any idea how to solve it in a more efficient way so im not doing unecessary database queries?
    • 1
    • 3
  • c

    Crypto Salomão

    01/17/2021, 8:48 AM
    Hello everyone
  • c

    Crypto Salomão

    01/17/2021, 8:48 AM
    Any progress with this feature? https://github.com/prisma/prisma/issues/5079
    m
    • 2
    • 1
  • c

    Crypto Salomão

    01/17/2021, 8:48 AM
    Needing this so much right now that I'm considering migrating from Prisma to another lib
  • a

    Ari Seyhun

    01/18/2021, 3:31 PM
    Hey guys, I'm having trouble getting started with the Rust FaunaDB crate Having an error with the following code:
    Copy code
    let obj = {
        let obj = Object::default();
    
        obj.insert("id", store.id);
        obj.insert("active", store.active);
        obj.insert("paid", store.paid);
    
        obj;
    };
    
    let query = client.query(Create::new(Ref::class("stores"), obj));
    With the error:
    Copy code
    21 |         let query = client.query(Create::new(Ref::class("stores"), obj));
       |                                  ^^^^^^^^^^^ the trait `std::convert::From<()>` is not implemented for `faunadb::prelude::Query<'_>`
    EDIT: Nevermind... I relalised I had a dumb mistake. My function was:
    Copy code
    pub fn new(client: &Client, &store: &Self) {
    But should've been:
    Copy code
    pub fn new(client: &Client, store: &Self) {
    🦀 2
  • a

    Ari Seyhun

    01/18/2021, 4:28 PM
    It seems like the FaunaDB Rust crate is abandoned 😞
    j
    • 2
    • 3
  • a

    ashok

    01/19/2021, 1:07 AM
    Hi all! Excited to be part of the community. I'm pretty new to prisma. Have mostly been using knex.js in the past. I really like Prisma so far as I've experimented but my big concern is the lack of a production ready migration feature.
  • a

    ashok

    01/19/2021, 1:07 AM
    How are other people using Prisma in production if
    prisma migrate
    is still not production ready?
    👍 1
    j
    r
    • 3
    • 23
  • a

    ashok

    01/19/2021, 1:08 AM
    I know prisma is a new way to think about ORM's so I'm curious if I'm missing something.
  • p

    Patrick

    01/19/2021, 9:19 AM
    Are there any benchmarks for prisma to compare to typeorm and/or mikro-orm?
    n
    • 2
    • 2
  • e

    Eden Lane

    01/20/2021, 2:03 PM
    Hi! I'm trying to setup Jest tests but I have a problem with connection to DB. I get an error:
    Copy code
    error: Environment variable not found: DATABASE_URL.
    despite the fact I have it in my
    prisma-test-environment.js
    (like in the examples directory). Can somebody help me with that?
    ✅ 1
    r
    • 2
    • 13
  • p

    Pitakun

    01/20/2021, 3:20 PM
    Hi, im trying to do a delete with multiple parameters. Seems kinda weird that the where field is only for unique columns. I have to do a query first to query the record. Then another query to delete the record itself? Is there a better eay to do this?
    n
    • 2
    • 14
  • i

    iamclaytonray

    01/20/2021, 4:20 PM
    How can I create my datamodels as PascalCase but keep my actual PG database tables/columns as snake_case?
    d
    n
    a
    • 4
    • 5
1...412413414...637Latest