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

    Michael

    06/14/2021, 9:15 PM
    I'm a bit new to
    pnpm
    , but I'm wondering how best to configure node_module dependencies for Prisma in projects that have multiple subprojects - where more than 1 subproject would use Prisma. For example - in my current project I
    hoist
    everything by default so when I run
    npx prisma generate
    it generates
    @prisma/client
    based on my DB/Prisma modules in the root project folder. But I wonder I had another project that used Prisma if this would compete and overwrite the common
    @prisma/client
    package in root. Sorry if this is confusing (again new to
    pnpm
    ) but is this a problem I am making up (ie would
    pnpm
    handle this appropriately by default)? And if not, how best to configure subprojects like this for Prisma with
    pnpm
    ?
  • s

    Scratchyone Scratchyone

    06/15/2021, 2:03 AM
    How can I correctly do joins with prisma? I have a Post model that contains a list of Votes, and I'm trying to run a query that returns every post and also includes a field in each post object containing the sum of the amount field in every vote attached to that post
    r
    • 2
    • 7
  • p

    Philippe

    06/15/2021, 7:16 AM
    Good morning. I've 2 questions regarding Prisma 1. Is there a way to have multiple schema.prisma files to split models per categories for example ? 2. How can we use prisma with multiples DB in the same app ? (I mean how to handle models per DB ) thanks a lot for your help
    r
    • 2
    • 2
  • g

    Guillaume Le Nistour

    06/15/2021, 7:18 AM
    Hi guys, nice too meet you all. I’ve been using Prisma with fastify since few days, and it’s amazing.
    prisma rainbow 2
    fast parrot 2
    👋 1
  • s

    stephan levi

    06/15/2021, 7:30 AM
    is there a way to make the PRISMA DEPLOY and PRISMA GENERATE processes faster ???
    j
    • 2
    • 3
  • d

    Davedavedave

    06/15/2021, 8:27 AM
    How are you folks handling create-DTOs in Nestjs with Prisma autogenerated Types? Anybody got a properly working example with relations?
    r
    • 2
    • 2
  • u

    user

    06/15/2021, 8:31 AM
    What's new in Prisma (v2.25.0)

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

    Niko and Ryan from the Prisma team discuss news in the Prisma ecosystem. Tune in to learn about new releases, planned features, and other interesting bits from the Prisma world. Learn more about Prisma: ◭ Website: https://www.prisma.io​​​​ ◭ Docs: https://www.prisma.io/docs​​​​ ◭ Getting started: https://www.prisma.io/docs/getting-started/
  • d

    Davedavedave

    06/15/2021, 9:33 AM
    I want to use the autogenerated Types of my model to typehint a dto, however fields created for a relation also exist on this type (even though they are only for internal use right?) Whats the best way to go about this?
  • d

    Davedavedave

    06/15/2021, 10:19 AM
    when I update a record whose model has connected fields, do i have to explicitly map those to the referenced name in the relation?
    Copy code
    .update({
      data: {
              ...updateData,
              origin: {
                connect: {
                  city: origin
                },
              },
            },
      where: {id},
    }
    r
    • 2
    • 11
  • m

    Manish

    06/15/2021, 1:11 PM
    Hello, In the following relation:
    Copy code
    model Post {
      id         Int         @id @default(autoincrement())
      categories Category[]
    }
    
    model Category {
      id    Int     @id @default(autoincrement())
      name String
      posts Post[]
    }
    If I have a list of categories, like:
    [{ id: 3, name: 'books'},{ id: 5, name: 'movies' }]
    How can I find all posts that have atleast one of these categories?
    f
    r
    • 3
    • 39
  • g

    Gian Franco Fioriello

    06/15/2021, 3:24 PM
    Hi there! I want to know how is your workflow for backfilling data with Prisma❓ Scenario: Add a new column (not nullable and unique) for an existing table full of data. Currently I'm doing the following: • create the migration at hand (NOT using Prisma Migrate tool) • add SQL script for adding new column (without nullabe and unique constraints) • add SQL script for backfilling data • add constraints to column there are other alternatives? maybe using seeds files? I would love to use Prisma Client code to backffill my database, but I'm not sure if there is any way to do it.
    s
    • 2
    • 2
  • s

    Subash Ganesh

    06/15/2021, 4:14 PM
    Hi Everyone! I am new to prisma. I need save image in Postgres. I am using Prisma with nestjs. Using Model Type 'Bytes'. How can I save the image. Any example to save image during prisma.modelname.create() would be welcome. Thanks in advance.
    c
    r
    +2
    • 5
    • 7
  • e

    Edward Baer

    06/15/2021, 4:35 PM
    Not sure if this is the correct location to ask this question, but: How do I Call and get the return values from a Stored Procedure using Prisma. Here is the Stored Procedure Syntax: CALL GetSequenceBlock('ach', 0, @start, @end) From what I can find in the documentation, any Prisma call has to start with a SELECT, but that doesn't seem to be allowed by MySQL. ie: SELECT @start, @end FROM ( CALL GetSequenceBlock('ach', 0, @start, @end) );
    j
    m
    r
    • 4
    • 32
  • s

    Samuel Corsi-House

    06/15/2021, 4:45 PM
    Copy code
    ❯ npm install -D prisma@2.25.0
    npm ERR! Cannot read property 'matches' of null
    How can I install it properly? Note I would like to use
    pnpm
    but prisma always seems to try to install with
    npm
    j
    • 2
    • 3
  • j

    Jonathan Blair

    06/15/2021, 6:37 PM
    Has there been any updates on support for splitting prisma schemas into multiple files?
    j
    r
    • 3
    • 2
  • j

    Jonathan Blair

    06/15/2021, 6:37 PM
    Our schema file is getting massive and hard to maintain
    plus one +1 1
    j
    • 2
    • 1
  • m

    Mykyta Machekhin

    06/15/2021, 8:53 PM
    Hello everyone guys. I had a fear that the
    upsert
    is non-transactional. After completing many
    upsert
    asynchronously, one of the call fell with a uniqueness error. That is, as I understand it, the prisma first run a select, and there is no record. Then value from other call writing down in a DB, after that the prisma tried to write down value, believing that it is not present in a DB that ended with an error Is this expected behavior? If so, can this point be recorded in the documentation? And the main question - how can we simulate an
    upsert
    transactionally?
    r
    • 2
    • 5
  • d

    Dário Nascimento

    06/15/2021, 11:13 PM
    Hello everyone! I am trying to connect to Microsoft SQL Server using AD Domain (Windows Auth) from Linux/OSX but it doesn't work https://github.com/prisma/tiberius/issues/97 Is someone having the same issue?
    d
    k
    • 3
    • 6
  • g

    George

    06/16/2021, 7:07 AM
    Do you guys have a Discord channel? Much appreciated.
    r
    • 2
    • 1
  • m

    matthew

    06/16/2021, 8:26 AM
    Hi Everyone Has anyone used AWS secrets to inject env values into a container? Its works great, the only issue is the values are stored in one key value pair as a json string e.g:
    Copy code
    DBCLUSTER_SECRET="{\"password\":\"pass\",\"dbname\":\"dbname\",\"engine\":\"mysql\",\"port\":3306,\"host\":\"localhost\",\"username\":\"user\"}"
    Prisma wants a DB URL within the schema file. Is is possible to parse the JS string within the Prisma schema? Or any idea if its possible to have each value as a key value pair, from AWS rather than on JSON string?
    Copy code
    DB_PASSWORD=pass
    r
    • 2
    • 2
  • b

    Benjamin Kroeger

    06/16/2021, 10:22 AM
    Does anyone know the meaning of
    isGenerated
    and
    dbNames
    properties of
    DMMF.Field
    ? Any hint is welcome!
  • h

    Halvor

    06/16/2021, 11:01 AM
    I have a table that i need to get all records for a userId from. But need to lookup userId based on username from another table. Then aggregate the columns using a summarization function.
  • h

    Halvor

    06/16/2021, 11:01 AM
    How can i achieve this?
    r
    • 2
    • 1
  • b

    Bård

    06/16/2021, 12:55 PM
    Sorry if this is documented in the docs, but I couldn’t find it. If I have a DateTime field in the database. Is there any way to query based on dates? I want to query for all data that has the same Date as today.
    r
    • 2
    • 3
  • t

    Tharshan

    06/16/2021, 1:44 PM
    Hi there, we have been applying the soft delete middleware and we noticed that our updateMany calls are giving this error But based on the query - this should not happen.
    j
    • 2
    • 1
  • y

    Yilmaz Ugurlu

    06/16/2021, 1:59 PM
    Hi all, all of a sudden after upgrading to 2.25.0 I got this error.
    Copy code
    Query engine binary for current platform "darwin" could not be found.
    This probably happens, because you built Prisma Client on a different platform.
    (Prisma Client looked in "/query-engine-darwin")
    
    Searched Locations:
    
      /.prisma/client
      /Users/metoikos/xxx/project/node_modules/lib/node_modules/@prisma/client
      /
      /
      /
      /tmp/prisma-engines
      /
    The engine at the
    project/node_modules/.prisma/client/query-engine-darwin
    and
    /Users/metoikos/xxx/project/node_modules/lib/node_modules/.prisma/client
    path I can see it but somehow Prisma cannot found. Is there a way that I can point client to the right location to find the engine.
    r
    j
    • 3
    • 5
  • j

    Jack Tan

    06/16/2021, 2:07 PM
    Hi there, excellent work on Prisma btw. I have this problem that is been stopping me from going further. Everytime I made a change in my enum (either update or remove it), I constantly get an error saying “Expected array type”. More info here: https://github.com/prisma/prisma/issues/7638 I reseted my database, wipe everything clean, everything works. When I removed one of my enum, I get that same error again. Does anyone know who I can talk to regarding this case? I'm on the most recent version in Prisma. What can I do to help?
    r
    • 2
    • 5
  • h

    Halvor

    06/16/2021, 3:42 PM
    anyone having issues with ts-node-dev and prisma?
  • h

    Halvor

    06/16/2021, 3:43 PM
    For some reason it does not refresh when using "ts-node-dev --respawn src/index.ts" if index.ts uses prisma.
  • h

    Halvor

    06/16/2021, 3:48 PM
    according to documentation disconnect() is handles automatically now.
1...444445446...637Latest