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

    Tommy Adeniyi

    02/21/2022, 7:02 PM
    Same thing for github the for
    access_token
    and
    token_type
  • t

    Tommy Adeniyi

    02/21/2022, 7:55 PM
    nvmd I figured it out. I adjusted my schema
    prisma rainbow 1
    šŸ‘ 2
    šŸ™Œ 2
  • j

    Jim Jeffers

    02/22/2022, 5:22 AM
    I have an API that I'm deploying via the serverless framework. The problem I'm running into is that my RDS instance cannot be accessed outside of the VPC that cloud formation sets up by default. Unless I create a bastion host within the same security group I can't connect from my development machine or CI pipeline to run the initial (or any) migration. It seems like a huge hassle. Is there a better way to execute a Prisma migration from within an a lambda to avoid all of the additional tooling? If so I could just invoke a cloud function to execute any migrations to production.
    n
    • 2
    • 3
  • v

    Vicky

    02/22/2022, 7:09 AM
    Hello guys can you help me?
    n
    • 2
    • 3
  • v

    Vicky

    02/22/2022, 7:17 AM
    Anyone yt?
  • k

    Kasir Barati

    02/22/2022, 4:34 PM
    Hello Why prisma cannot create record and say you did nit set the required field even due I have been set it? and Why it says I have to fill a
    relation field
    ?
    Copy code
    model Country {
      id                   Int     @id @default(autoincrement())
      // Country Code Alphabet 3
      cca3                 String  @unique() @db.VarChar(3)
     
      states               State[]
      capital              City?   @relation(name: "country_capital")
     
      @@map("countries")
    }
    
    model State {
      id                   Int     @id @default(autoincrement())
      // State Code Alphabet 3
      sca3                 String  @db.VarChar(3)
      countryId            Int
    
      belongsToCountry     Country @relation(fields: [countryId], references: [id], map: "belongs_to_country")
    
      @@index([sca3])
      @@map("states")
    }
    Any thought on this?
    šŸ˜€ 1
    āœ… 1
    a
    r
    • 3
    • 4
  • c

    Cirsten Kot

    02/22/2022, 5:41 PM
    Hi Guys! I am a complete newbie. I am following the great course /Fullstack App With TypeScript, PostgreSQL, Next.js, Prisma & GraphQL: Data Modeling from: Mahmoud. I am waiting with great expectations šŸ˜‰ for the new and probably the latest part. I have the code working. I still need some help with returning to the code that also visitors can see all the links created. Now you have to login. Is there anyone who could help me with this?
  • a

    Alex Vilchis

    02/22/2022, 8:29 PM
    Hello guys šŸ‘‹ Does anyone know how to pass request information from my API to a Prisma middleware? I want to obtain the user id of the client that is executing a query so that I can use it as a filter for the
    owner
    column šŸ¤”
  • r

    Ruslan Gonzalez

    02/22/2022, 9:17 PM
    Hello there, need some help on the search using previewFeature filterJson when a property doesn't exist ,,, it would ignore the document or would throw an error?
  • a

    aetheryx

    02/23/2022, 5:03 AM
    Will we see something similar to the
    type
    support for MongoDB in SQL databases (mapping to
    Json
    , but giving us typescript typings and safety)?
    d
    j
    • 3
    • 4
  • b

    Boo

    02/23/2022, 5:37 AM
    Is there a way in prisma schema to make sure that
    DateTime
    is ordered correctly when creating new rows?
  • l

    Luis Kuper

    02/23/2022, 9:42 AM
    Question Regarding Optimistic concurrency control https://www.prisma.io/docs/guides/performance-and-optimization/prisma-client-transactions-guide#when-to-use-optimistic-concurrency-control Is there a reason not to use a column
    updatedAt  DateTime @updatedAt
    instead of the in the docs mentioned
    version
    column? The code would then look like this:
    Copy code
    const availableSeat = await client.seat.findFirst({
      where: {
        Movie: {
          name: movieName,
        },
        claimedBy: null,
      },
    })
    
    if (!availableSeat) {
      throw new Error(`Oh no! ${movieName} is all booked.`)
    }
    
    const seats = await client.seat.updateMany({
      data: {
        claimedBy: userEmail,
      },
      where: {
        id: availableSeat.id,
        updatedAt: availableSeat.updatedAt,
      },
    })
  • p

    PanMan

    02/23/2022, 10:56 AM
    I have a very strange issue: Prisma is saying my auth details are wrong, but the same URL works fine in Sequel Ace, and I can also connect command line (
    mysql -u etc
    ) from my laptop, so there is no firewall or other issue.. There are no strange chars in the URL that would need encoding. Any pointers? Even at highest debug level, Prisma doesn’t show the password it sends (which I understand from security standpoint, but still, the only thing I can think of is it sending a different password than I tell it to…)?
    o
    • 2
    • 5
  • e

    Elijah Rosier

    02/23/2022, 11:32 AM
    Does anyone know of a way that we can use one database URL for reads and one URL for writes so that writes are spread across the cluster as opposed to all going to the write endpoint generated by the RDS cluster?
    a
    • 2
    • 1
  • c

    Carlos Weckesser

    02/23/2022, 11:47 AM
    Hi! šŸ‘‹ I’m quite new to Prisma and I’ve recently using it in a project and it has worked quite well for me. I now have to implement some logic that involves writing to the database and making POST/PUT/DELETE calls to an external API. I want to implement the Unit of Work pattern to execute all these ā€œdata writingā€ operations in a way that, if the external API call fails then the transaction should be rolled back. To that end, I decided to use the preview feature ā€œinteractive transactionsā€. The problem I face now, is that it’s quite challenging writing unit tests for that because the logic to be unit tested is within the body of an
    async
    function passed to the
    prisma.$transaction()
    function. I’m using Jest to mock the Prisma client, but in this case I would have to provide a mock for the
    prisma.$transaction()
    function and in doing so, I would be replacing the very logic I’m trying to unit test. I hope I explained the case well enough. I’d really appreciate some guidance from any that has run into this scenario. Thanks in advance! P/S: Is the Prisma Team planning to implement manual transaction control (start, commit, rollback)?
    o
    • 2
    • 2
  • m

    Marvin

    02/23/2022, 12:23 PM
    Hey everyone! šŸ‘‹ I struggle with the decision what type of many-to-many relation I should use (explicit or implicit). I know what it does and also when to use it but is it hard to migrate from an implicit to an explicit later if I need extra data for the relation some day? I'm always a fan of being explicit but the explicit many-to-many relation adds overhead, especially for queries although I don't need to be explicit because I don't need any extra information (yet). I would love to hear your feedback on this and how often you really need to be explicit with the relation!
    n
    m
    • 3
    • 3
  • m

    Matheus Assis

    02/23/2022, 12:41 PM
    Maybe unrelated to prisma itself, but it’s related to database and I’m using prisma. And someone might be able to help. I’m setting up for CI/CD for our frontend project(using github actions). And I need to run the tests(cypress) on each PR to block merge if they fail. How do you guys create an instance of the backend and database for that? • Do you create a new Backend/Database instance from scrach for every PR? • Do you use an existing
    dev
    backend/database but reset all the data? • Do you use an existing
    dev
    backend/database but don’t reset all the data and have the tests work around other data on the dev environment?
    n
    • 2
    • 2
  • s

    shahrukh ahmed

    02/23/2022, 2:12 PM
    Bit of a noob here when it comes to the backend. I am looking at using GitHub Actions for continuous integration. My question is do you guys also push the migration files in prisma/migrations or no? Will these pushed migration files be used in any case when running
    npx prisma migrate deploy
    ?
    m
    • 2
    • 2
  • k

    karolis

    02/23/2022, 2:50 PM
    Hey, frontend guy here. Is there a service where I could plug my prisma schema and it will auto generate i.e. express REST api for my models?
    t
    n
    • 3
    • 3
  • l

    Luis Haroldo Castro Cabrera

    02/23/2022, 4:27 PM
    Property not known: "output". is this expected? was working before
  • r

    Ranjan Purbey

    02/24/2022, 12:25 AM
    Is there a way to find the names of primary key colums on a table?
  • p

    Peter Kellner

    02/24/2022, 5:12 AM
    Is there a good Docker Image setup for Prisma that's maintained by the team or those close? I'm using MySql and SqlServer and I'm struggling with combining Apollo Server and Prisma in one Image. Maybe Vanilla and Vanilla is better then the Swirl. Thinking maybe I should make GraphQL one image and Prisma it's own.
    e
    • 2
    • 3
  • h

    Hussein

    02/24/2022, 6:08 AM
    I have a users table and an orders table. Is there a way that I can set user.name as a default value for the field ā€œcreatedByā€ in the orders model ?
  • j

    Jonas Schultheiss

    02/24/2022, 7:48 AM
    Hello everyone, We’re currently recreating a js/express microservice backend in ts/nestjs. Early in january I testd prisma vs typeorm and was impressed. Though I only tested it in a small monolithic environment. Now we got multiple microservices build with the nestjs microservice architecture and a gateway, glueing the services to a rest api. the problem i now see is that all the types are generated in the services. if i want to type the functions in the gateway or use swagger then i have to rewrite every type. is there an easy way to export generated types to put them into a npm module? was this use case considered?
    j
    t
    • 3
    • 4
  • g

    gustav

    02/24/2022, 11:04 AM
    Is anyone writing migration scripts in Typescript with the Prisma client? I am pretty tired of struggling with SQL
  • g

    gustav

    02/24/2022, 11:05 AM
    If you have any good thoughts on this I’d love to hear it
  • g

    gustav

    02/24/2022, 11:05 AM
    how to structure and run the migration scripts
  • g

    gustav

    02/24/2022, 11:08 AM
    something like this: https://github.com/prisma/prisma/issues/4688
  • a

    Arjen

    02/24/2022, 11:10 AM
    Hello Everyone, We have been building on top of Apollo and Prisma1 and are finally migrating to Prisma2, but are running into a lot of schema incompatibilities. Since Prisma1 is both an ORM as a GraphQL API we were used to building upon the Prisma1 generated GraphQL schema (opencrud). Over the years our prisma model has grown and is now used trough Apollo by two Apps and React Admin (ra-data-opencrud). With this setup as our staring point we started to look for a way to generate a compatible GraphQL schema for Prisma2. Prisma2 has the concept of generators with a bunch already written by the community: https://www.prisma.io/docs/concepts/components/prisma-schema/generators We started out by looking at the graphql-schema-generator, but this schema is much simpler and nowhere close to the Prisma1 generated GraphQL schema. TypeGraphQL Prisma comes closer, but there are still a lot of incompatibilities. Fixing these incompatibilities might be weeks or maybe months of work. Building our own generator would be a huge project as well. This all made me wonder if I'm missing something? It shouldn't be this hard to migrate, should it? Not entirely sure what to do at this point: • Is there a generator out there that is compatible that I haven't found? • Or should we just implement compatible resolvers ourselves in apollo? • Or pick for instance TypeGraphQL and rewrite the data layer of our App? • What is the risk of staying on Prisma1?
  • k

    Kanav Raina

    02/24/2022, 11:34 AM
    const users = await prisma.users.groupBy({
    by: ['email'],
    _sum: {
    likes:true
    }
    })
1...548549550...637Latest