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

    Halvor

    08/30/2021, 3:34 PM
    How can in a single query create a resource like the below, and if one already exists with "uuid" as specified and "deleted" bool update it instead? How to workaround that the boolean "deleted" can not be used to uniquely identify the map table?
    Copy code
    const result1 = await prisma.map.upsert({
                where: {
                    uuid: query.uuid
                    deleted: true
                },
                update: {
    
                },
                create: {
                    user: {
                        connect: {
                            id: query.userId
                        }
                    },
                    uuid: query.uuid
                    deleted: false
                }
    }
    c
    • 2
    • 2
  • e

    Eric Chen

    08/30/2021, 9:44 PM
    has anyone else faced this issue when trying to deploy on AWS Amplify? - been searching for hours but everything leads back to an open issue on github with no solution 😞
    2021-08-30T21:43:19.225Z [ERROR]: Error: Command failed with exit code 1: node_modules/.bin/next build
    Failed to compile.
    ModuleNotFoundError: Module not found: Error: Can't resolve '_http_common' in '/codebuild/output/src843141263/src/postpanion2/node_modules/@prisma/client/runtime'
    > Build error occurred
    Error: > Build failed because of webpack errors
    at /codebuild/output/src843141263/src/postpanion2/node_modules/next/dist/build/index.js:390:19
    at async Span.traceAsyncFn (/codebuild/output/src843141263/src/postpanion2/node_modules/next/dist/telemetry/trace/trace.js:60:20)
    👀 1
    r
    • 2
    • 2
  • h

    Halvor

    08/30/2021, 10:19 PM
    Can i somehow combine a primary key and a boolean with findUnique() ? primary key should handle this but i get "is not assignable to TABLEWhereUniqueInput"
    r
    • 2
    • 5
  • w

    Walter Díaz

    08/31/2021, 4:00 AM
    Any approach to Unsupported("Point")? https://stackoverflow.com/questions/68987595/prisma-unsupportedpoint-mysql-approach
    r
    • 2
    • 1
  • d

    Dev__

    08/31/2021, 8:32 AM
    if I have an instance of
    Error
    , does it also work if I use
    PrismaClientKnownRequestError
    . example
    Copy code
    catch(error) {
      if (error instanceof PrismaClientKnownRequestError) { // does this also check for instance of Error since its extending Error
        ...
      }
    }
    r
    • 2
    • 1
  • k

    Kyle (TechSquidTV)

    08/31/2021, 11:47 AM
    Sorry to share again. If anyone has any tips for a beginner of the framework I would appreciate it. Having trouble getting started: https://prisma.slack.com/archives/CCWDULGUW/p1630258320018900https://prisma.slack.com/archives/CCWDULGUW/p1630258320018900
  • h

    Hei

    08/31/2021, 11:54 AM
    Not really a issue, just wanna ask how do you run or execute your migration script when it is dockerized? Do you create an entrypoint for your backend or do you have a separate Dockerfile or docker-compose for migration?
  • m

    manuel

    08/31/2021, 6:26 PM
    Hi! Does anyone know how I can debug this?
  • m

    manuel

    08/31/2021, 6:26 PM
  • b

    Bryan Migliorisi

    08/31/2021, 6:36 PM
    I've noticed more SAAS products following a pattern of prefixing entity IDs with a few letters for the purpose of quickly identifying what type of entity is represented by the ID, for example a
    Product
    in Stripe would look like
    prod_abcdefg
    while a
    Customer
    would have
    cus_abcdefg
    ... I know I could manually generate IDs in my code, but it would be very cool if I could do something like this in the schema
    Copy code
    model Customer {
      id        String   @id @default(cuid(prefix: "cus"))  
    }
    🙌 1
    s
    r
    • 3
    • 4
  • t

    Tyler Clendenin

    08/31/2021, 9:50 PM
    What would be the easiest way to debug the seed.ts with VSCode??
    r
    • 2
    • 3
  • h

    Halvor

    08/31/2021, 10:04 PM
    Is there ideas to support filtering based on relations in where clause for findUnique?
    r
    • 2
    • 11
  • h

    Halvor

    08/31/2021, 10:31 PM
    How can i make the list returned by findMany to use the proper type?
    Copy code
    const [mapCount, mapList] = await prisma.$transaction([
                prisma.user.count(),
                prisma.map.findMany()
    ]);
    r
    • 2
    • 18
  • h

    Halvor

    08/31/2021, 10:32 PM
    It says mapList is of type {}[] but it should be of type Map[]
  • a

    Austin Turner

    09/01/2021, 12:29 AM
    Anyone have an idea of what might be wrong with this
    @relation
    ? EDIT: I figured it out, I guess that the lookup field also need to include
    @db.Uuid
    💯 1
  • g

    Gelo

    09/01/2021, 5:10 AM
    Date(now()) is always 1 day late?
    r
    • 2
    • 1
  • k

    kkangsan

    09/01/2021, 5:33 AM
    orderBy_value_with_string_.ts
    r
    • 2
    • 12
  • k

    kkangsan

    09/01/2021, 5:33 AM
    How can I order by 'desc' if the value is a string? Is it not possible to do the query I want with prisma?
  • p

    Patrick Sheehan

    09/01/2021, 9:20 AM
    Has anyone here deployed prisma using pulumi to aws lambda? I’m able to generate and output my schema just fine, but when I try to import it into one of my lambda functions and run the
    pulumi up
    command, I get the follow error
    Copy code
    error: Running program '/platform-cloud-services' failed with an unhandled exception:
        Error: Remote object was not 'function': {"type":"object","className":"Function","description":"Function","objectId":"-2560291290870578958.2.6040"}
            at /platform-cloud-services/node_modules/@pulumi/pulumi/runtime/closure/v8_v11andHigher.js:149:23
            at Generator.next (<anonymous>)
            at fulfilled (/platform-cloud-services/node_modules/@pulumi/pulumi/runtime/closure/v8_v11andHigher.js:18:58)
            at processTicksAndRejections (node:internal/process/task_queues:96:5)
    I suspect is has something to do with the pulumi not playing well with engine, but if anyone has had success I could use the help
  • k

    Kay Khan

    09/01/2021, 9:53 AM
    can you generate prisma-client based on preexisting database thats not generated/migrated using prisma?
    m
    • 2
    • 8
  • m

    Mykyta Machekhin

    09/01/2021, 11:32 AM
    Hello. I started getting many errors like this when trying to create a client. reinstalling dependencies does not give the desired result. Someone knows what could be wrong?
    d
    • 2
    • 6
  • i

    Ittsel Ali

    09/01/2021, 1:13 PM
    Hello everyone, can somebody answer the question regarding graphcool framework. Does graphcool works as a gateway and sit over graphql services like Apollo Federation?
  • m

    Mateusz Żmijewski

    09/01/2021, 2:18 PM
    Hi! I'm not entirely sure if I have a prisma problem, but maybe you could help me. I'm using moment timezone library to get a date from a +2h timezone. We used to have typeorm so it would only save a date, now it's datetime and for some reason it gets saved as yesterday's date 220000. Do you know what I should do to get a proper date for example today 2021-9-1 000000?
    r
    a
    • 3
    • 2
  • k

    Kay Khan

    09/01/2021, 3:23 PM
    Hi friends, is it possible to query views using the prisma client? I have generated the models using
    prisma db pull
  • k

    Kay Khan

    09/01/2021, 3:26 PM
    Oh it looks lke you have to manually add views as a model to your `schema.prisma`https://www.prisma.io/docs/guides/database/advanced-database-tasks/sql-views-postgres#5-manually-add-the-draft-view-to-the-prisma-schema can anyone confirm if thats stil the case (its not able to pull the views)? The documentation says
    Note that as you evolve the application, this process can be repeated for an indefinite number of times.
    referring to the commands
    prisma db pull
    and
    prisma generate
    I wonder how that affects workflow when you want to pull again at a later date, does the manually added models (in this case the views) get deleted and you have to manually readd them? --- I just tried this
    prisma db pull
    will remove any manual models (views) you add to schema.prisma 😢
    r
    • 2
    • 1
  • m

    Michael Stewart

    09/01/2021, 5:35 PM
    Hi there!! I’m trying to use
    set:
    on an explicit many to many relation, is that possible ?? because when I try to do so I get this error: `The change you are trying to make would violate the required relation ‘TrainersOnVenuesToTrainingVenue’ between the
    TrainersOnVenues
    and
    TrainingVenue
    models.`
    r
    • 2
    • 1
  • c

    Cole Voss

    09/01/2021, 5:57 PM
    Is sort by relation out of preview?
    r
    • 2
    • 1
  • r

    Rodrigo Scomação do Nascimento

    09/01/2021, 6:58 PM
    Hey guys, how is everyone?
  • r

    Rodrigo Scomação do Nascimento

    09/01/2021, 6:58 PM
    I have some questions about Prisma usage, that I couldn't find an answer to:
  • r

    Rodrigo Scomação do Nascimento

    09/01/2021, 7:00 PM
    • Is there a way to have multiple schema.prisma files? One for dev, one for prod and one for testing. I'd like to use sqlite for testing and MySQL for dev/prod...
    r
    • 2
    • 4
1...476477478...637Latest