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

    Svante Bengtson

    03/04/2022, 12:33 AM
    Hi, I'm trying to use prisma with mssql and need to define a partial unique index, but I can't figure out how, and if I only specify a "normal" @@unique prisma migrate constantly tries to overwrite the partial one I have in place
    j
    • 2
    • 3
  • p

    prisma chobo

    03/04/2022, 5:47 AM
    after prisma db pull and prisma generate. When I do
    prisma.user.create({ ... })
    it gives me
    Property 'id' is missing in type
    error.
    Copy code
    model User {
      email        String    @unique
      password     String?
      roles        Role[]
      tokenVersion Int       @default(0)
      username     String
      createdAt    DateTime  @default(now())
      updatedAt    DateTime  @default(now())
      deletedAt    DateTime?
      provider     String?
      providerId   String?
      id           String    @id
    
      @@unique([provider, providerId])
    }
    n
    • 2
    • 1
  • p

    prisma chobo

    03/04/2022, 5:48 AM
    The data needed to create a User.
  • p

    prisma chobo

    03/04/2022, 5:49 AM
    Why is it so..?
  • p

    prisma chobo

    03/04/2022, 5:50 AM
    Oh I got it it is missing
    @default(cuid())
    this. But why prisma db pull does not generae
    @default(cuid())
    ??
  • p

    prisma chobo

    03/04/2022, 5:53 AM
    DB was created by the following shema:
    Copy code
    model User {
      id                          String                      @id @default(cuid())
      email                       String                      @unique
      password                    String?
      provider                    String?
      providerId                  String?
      roles                       Role[]
      tokenVersion                Int                         @default(0)
      username                    String
      // *************** RELATIONS *****************
      // *******************************************
      createdAt                   DateTime                    @default(now())
      updatedAt                   DateTime                    @default(now())
      deletedAt                   DateTime?
    
      @@unique([provider, providerId])
    }
    and when i prisma db pull, it generates the following schema:
    Copy code
    model User {
      email        String    @unique
      password     String?
      roles        Role[]
      tokenVersion Int       @default(0)
      username     String
      createdAt    DateTime  @default(now())
      updatedAt    DateTime  @default(now())
      deletedAt    DateTime?
      provider     String?
      providerId   String?
      id           String    @id
    
      @@unique([provider, providerId])
    }
    which either I have to manually add
    @default(cuid())
    or i have to insert ID manually when I create user object. Am I missing something here ? is it expected outcome?
  • y

    YeonHoPark

    03/04/2022, 7:33 AM
    Hi. I have two question about the code below. 1. why nexus makes 2(NexusGenObjects, NexusGenFieldTypes) different interface ?. I cant’t find it in the nexus official document. 2. what does “field return type” means in NexusGenFieldTypes ? 🤔 I think it’s because of the characteristics of graphql, but I don’t know the exact reason. thank you !!
    h
    j
    • 3
    • 2
  • j

    Josh

    03/04/2022, 8:34 AM
    Hi want to ask again about https://www.prisma.io/docs/guides/performance-and-optimization/prisma-client-transactions-guide#scenario-reserving-a-seat-at-the-cinema Mentioned in this issue https://github.com/prisma/prisma/issues/11790 and this issue https://github.com/prisma/prisma/issues/8612. Won’t both of this issue contradict with the current approach that prisma suggested on the scenario docs?
    👀 1
    m
    • 2
    • 4
  • u

    user

    03/04/2022, 9:02 AM
    Serverless Berlin Meetup - Yan Cui - Lessons from running AppSync in production

    https://www.youtube.com/watch?v=tH0I69t3-8I▾

    ◭ AppSync lets you build scalable and robust GraphQL API without having to worry about infrastructure. In this session, AWS Serverless Hero Yan Cui shares his personal experience of running AppSync in production - the good, the bad and some tips for dealing with common challenges such as testing VTL templates and overcoming the 500 CloudFormation resources limit. ◭ Get in touch with Yan: https://twitter.com/theburningmonk ◭ Join our Prisma Meetup group: https://www.meetup.com/pro/prisma-meetup/
    👀 1
  • l

    Lucas Souza

    03/04/2022, 1:28 PM
    hello people, i dont know if this is the correct channel for the subject, but i have interest in develop the issue Support for an Interface type #2506, what i need for?
    j
    • 2
    • 1
  • m

    Manikanta Talluri

    03/04/2022, 5:00 PM
    Hi, Does prisma support authenticating Azure SQL Server through Azure Active directory? For more info https://docs.microsoft.com/en-us/azure/azure-sql/database/authentication-aad-configure?tabs=azure-powershell In sequelize, we can pass options: {dialect, authentication: {type: 'azure-active-directory-password'}} Which uses npm mssql as connection library Is it even feasible in Prisma? Our team uses Azure SQL Server using Active Directory users. I tried to connect DB using below URL
    Copy code
    DATABASE_URL=sqlserver://<HOST>:<PORT>;database=<DB_NAME>;user={<USERNAME>@<AD_DOMAIN>};password={PASSWORD};encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.<http://database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword|database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword>
    n
    • 2
    • 1
  • j

    Juan Orellana

    03/04/2022, 8:42 PM
    Hi there, it's me again, when using queryRaw, we should handle boolean fields with 1 and 0 rather than true or false?, or is there a way to still use true and false?
    n
    • 2
    • 1
  • u

    user

    03/05/2022, 9:01 AM
    Serverless Berlin Meetup - Aleksandar Simovic - Designing Testable Serverless Applications

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

    ◭ Testing serverless applications has evolved from the first days of serverless. Serverless changed the way we were planning, building, and deploying apps. But it also changed the way we were testing serverless apps. We learned that when using serverless functions we should introduce Hexagonal Architecture. Hexagonal architecture enables us to design modular serverless functions that can be run and tested locally or in the serverless environment. It also allowed us to write unit tests without complex mocks, and write as many integration tests as you need. As a bonus, our code looks clean and it’s easy to maintain, and hexagonal architecture helps us fight vendor lock-in. The main goal of this talk is to show how to design testable serverless functions. It starts with an explanation of hexagonal architecture and it’s importance for serverless apps, and it ends with real-world examples using Node.js. ◭ Get in touch with Alex: https://twitter.com/simalexan ◭ Join our Prisma Meetup group: https://www.meetup.com/pro/prisma-meetup/
  • p

    Philipp Minder

    03/05/2022, 10:52 AM
    Hello. Im reworking on typescript. I use Prisma Input Types on express Request. Make this sense? Because i getting trouble when im sending relational objects
    l
    • 2
    • 1
  • d

    devabd

    03/05/2022, 9:33 PM
    Hi everyone. I am trying to run migrations with prisma and getting the following error. For more details, I have opened a discussion here https://github.com/prisma/prisma/discussions/12170 Thanks for your time and help.
    Copy code
    Environment variables loaded from .env
    Prisma schema loaded from prisma\schema.prisma
    Error: Get config: Schema Parsing P1012
    
    error: Error validating datasource `db`: the URL must start with the protocol `postgresql://` or `postgres://`.
      -->  schema.prisma:10
       | 
     9 |   provider = "postgresql"
    10 |   url      = env("DATABASE_URL")
       | 
    
    Validation Error Count: 1
    i
    n
    b
    • 4
    • 5
  • j

    Jonas

    03/06/2022, 9:49 AM
    Hey! Can I
    orderBy
    a date field?
  • j

    Jonas

    03/06/2022, 9:50 AM
    Or let's rephrase: should I be able to
    orderBY
    a date field? Because it doesn't seem to work right now for me.
    n
    • 2
    • 1
  • u

    user

    03/06/2022, 10:00 AM
    Serverless Berlin Meetup - Heitor Lessa - Lambda Powertools

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

    ◭ AWS Lambda Powertools is a collection of utilities to help customers adopt Serverless best practices, as defined in the Well-Architected Serverless Lens. It eases the adoption of distributed tracing, structured logging, application metrics, idempotency, feature flags, and more. Lambda Powertools is available for Python, Java, and TypeScript (beta). In this demo session, we'll introduce the core Lambda Powertools utilities, and briefly demonstrate how you can make your applications safer to retry with idempotency. ◭ Heitor Lessa is a Principal Solutions Architect in the AWS Developer Acceleration team covering EMEA. He has spent the last 14 years in various roles focusing on IT infrastructure, cloud operations, business development, developer tooling, and modern application development. Since joining AWS in 2013, he’s been helping Fortune 500 and SMB companies across EMEA with digital transformations, and their respective engineering teams to design cloud native applications following industry-leading practices. He's the lead author for the Well-Architected Serverless Lens since 2017, lead developer and PM for the AWS Lambda Powertools project, and previously live-streamed Build on Serverless & open_source.init() on AWS Twitch channel. ◭ Get in touch with Heitor: https://twitter.com/heitor_lessa ◭ Join our Prisma Meetup group: https://www.meetup.com/pro/prisma-meetup/
  • s

    Steven

    03/06/2022, 10:21 AM
    Has anybody found a nicer way to return Unsupported fields from the Prisma client? I understand that integrating postGIS with all its complexity is a large ticket item, but returning a Point field as a String sounds like an easy temporary solution for many - I don’t want to give up on Point/Polygon types and store them in the wrong format, just so Prisma can pull it through as a string. It’s mentioned that you cannot get these fields back from the generated client, even as a basic findMany return, and when using a raw query I’m stuck having to cast to a TEXT type within the psql query otherwise Prisma quaint fails to convert the postgres point to String also? https://www.prisma.io/docs/concepts/components/prisma-schema/features-without-psl-equivalent/#unsupported-field-types Maybe I’ve missed a basic technique, but right now I’ve have to leave behind any where/orderBy niceness to get all values back from a select, and it’s looking extremely hacky for production. Any suggestions to improve on this are highly appreciated! PostGIS support which I assume will resolve this limitation for geo types: https://github.com/prisma/prisma/issues/2789
    j
    • 2
    • 11
  • e

    EdwinJr

    03/06/2022, 11:07 AM
    Good morning all !
  • e

    EdwinJr

    03/06/2022, 11:10 AM
    I have a quick question ! Thank you in advance for any answer provided. I have a a model which is a User and it has a field called friends count. My question is it possible to have an automatic reference so that the count updates automatically when a friend deletes he’s account?
    👀 1
    t
    • 2
    • 9
  • m

    Muhammad Ameer Hamza

    03/06/2022, 1:33 PM
    how to connect prisma through ssh tunnel for postgres database ?
    n
    • 2
    • 1
  • j

    Jakub Figlak

    03/06/2022, 3:39 PM
    Hey folks, quick question. Let's say I have a model like so
    Copy code
    model ExampleModel {
      id         String @id @default(cuid())
      someValue  Int
      otherValue Int
    }
    how can I query for entities where
    Copy code
    someValue === otherValue
    ?
    • 1
    • 1
  • g

    Gonzalo iniguez

    03/06/2022, 5:05 PM
    Hi comunnity
  • g

    Gonzalo iniguez

    03/06/2022, 5:05 PM
    how can i get parent value in update instance
  • g

    Gonzalo iniguez

    03/06/2022, 5:05 PM
    prisma js
  • g

    Gonzalo iniguez

    03/06/2022, 5:05 PM
    example:
    j
    • 2
    • 3
  • b

    Bernat Jufré

    03/06/2022, 9:28 PM
    Hi there!!! I’m trying to build some CMS lib for a framework and I would like to generate the backend code based on the schema. So that anyone can plug it into their existing apps. Is there a way to introspect and/or get an AST from Prisma so that I can generate some types and extend the config of my lib?
    n
    j
    • 3
    • 2
  • j

    Jonas Rothmann

    03/07/2022, 12:59 AM
    Why is the map field on relations not exposed on DMMF
    plus one +1 2
    i
    • 2
    • 4
  • j

    Jijin P

    03/07/2022, 3:23 AM
    Hey, Any idea why this is happening? “Attempted to serialize scalar ‘null’ with incompatible type ‘Decimal’ for field points.” In the ads table, there are no fields named as points.
    Copy code
    Error:  Invalid `prisma_1.default.ads.findMany()` invocation in /usr/src/app/dist/api/offerwall/getClickCampaigns.js:16:50
    
      Attempted to serialize scalar ‘null’ with incompatible type ‘Decimal’ for field points.
        at Object.request (/usr/src/app/node_modules/@prisma/client/runtime/index.js:39813:15)
        at async PrismaClient._request (/usr/src/app/node_modules/@prisma/client/runtime/index.js:40637:18)
        at async getClickCampaigns (/usr/src/app/dist/api/offerwall/getClickCampaigns.js:16:23)
    i
    j
    • 3
    • 21
1...551552553...637Latest