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

    PrismaNuts

    11/30/2021, 10:30 PM
    Hi! What exactly does the "?" stand for in "String?"?
    j
    • 2
    • 1
  • j

    James Homer

    12/01/2021, 12:30 AM
    Will this feature make it into the roadmap? https://github.com/prisma/prisma/issues/10346 it’s become crucial for my use case, would love to know if it might happen eventually
  • g

    Gezim

    12/01/2021, 5:43 AM
    Hi folks. I’m getting a strange error
    Invalid prisma.account.upsert() invocation
    at runtime. TypeScript doesn’t show any issues. Details are here: https://github.com/prisma/prisma/discussions/10524
  • g

    Gezim

    12/01/2021, 5:43 AM
    I think it might be my crazy nesting but I don’t know.
  • g

    Gezim

    12/01/2021, 5:43 AM
    Any help would be appreciated.
  • u

    user

    12/01/2021, 9:01 AM
    Preview Deployment

    https://www.youtube.com/watch?v=oojjJh-51ZI▾

    In this video, you'll see a demo of an early concept our team is working on to make sure databases are smoothly integrated into all of your Preview Deployment workflows. Author: Nikolas Burk, Head of Developer Advocacy at Prisma Docs: https://www.prisma.io/docs/concepts/components/prisma-data-platform
  • m

    Mradul Jain

    12/01/2021, 9:37 AM
    Hi all, how i can connect sql server locally on ubuntu machine
  • m

    Mradul Jain

    12/01/2021, 9:38 AM
    when i am tring to connect it will give me error of Error: P1013
  • m

    Mradul Jain

    12/01/2021, 9:38 AM
    Error: P1013: The provided database string is invalid. Error parsing connection string: Conversion error: invalid digit found in string in database URL. Please refer to the documentation in https://www.prisma.io/docs/reference/database-reference/connection-urls for constructing a correct connection string. In some cases, certain characters must be escaped. Please check the string for any illegal characters.
  • d

    Daniel Saldarriaga

    12/01/2021, 9:57 AM
    Hello! Can anyone recommend me the best way of connecting two Prisma Clients that communicate to different schemas of the same Postgres database? I was able to fetch data from the two clients using raw SQL in Prisma with a weak connection, but I wanted to know if there is a way with better practices? Thank you in advance!
    t
    • 2
    • 1
  • u

    user

    12/01/2021, 2:00 PM
    Improving the Prisma Visual Studio Code Extension with WebAssembly The Prisma Visual Studio Code extension is a key pillar of Prisma's developer experience. It enables you as a developer to rapidly iterate on your Prisma schema while giving you useful feedback about the correctness of the schema and automatic formatting. Today we're excited to share that we've improved the reliability of the extension by replacing the Prisma engine binary with a WebAssembly module that is natively cross-platform.
    fast parrot 1
  • l

    Lars Ivar Igesund

    12/01/2021, 2:10 PM
    Is there a similar/corresponding plugin for webstorm?
    t
    • 2
    • 1
  • e

    Emre Deger

    12/01/2021, 2:58 PM
    We are using Prisma 2 in a project. I am having a BigInt problem in test cases. Prisma data (
    id: 1n
    ) and JSON response (
    id: 1
    ) data do not match. Anyone have an idea?
  • j

    Josh

    12/01/2021, 3:21 PM
    Hi guys, want to ask about this concurrency problem https://github.com/prisma/prisma/issues/8612 is the information stated here are true? because we currently having issue with multiple updateMany succeed even though we do as the docs here https://www.prisma.io/docs/guides/performance-and-optimization/prisma-client-transactions-guide#optimistic-concurrency-control
  • r

    rdunk

    12/01/2021, 4:29 PM
    Been away from Prisma for a while but getting back into it hopefully. Has Prisma 2 moved away from providing a server, i.e. focused more exclusively on the ORM side?
    n
    • 2
    • 3
  • r

    rdunk

    12/01/2021, 4:34 PM
    Sorry probably should just read the docs before start talking 🙂. The examples look pretty fleshed out, I guess this has everything I need for now! https://github.com/prisma/prisma-examples/tree/latest/typescript/graphql-auth
  • c

    Chris Bitoy

    12/01/2021, 5:48 PM
    Hi y’all. Does anyone know why this many-to-many code gives me this error:
    Copy code
    model Post {
      id    Int        @id @default(autoincrement())
      title String
      tags  PostTags[]
    }
    
    model PostTags {
      id     Int   @default(autoincrement())
      post   Post? @relation(fields: [postId], references: [id])
      tag    Tag?  @relation(fields: [tagId], references: [id])
      postId Int?
      tagId  Int?
    
      @@id([postId, tagId])
    }
    
    model Tag {
      id    Int        @id @default(autoincrement())
      name  String     @unique
      posts PostTags[]
    }
    Copy code
    //Error
    
    Error parsing attribute "@default": The `autoincrement()` default value is used on a non-indexed field even though the datasource does not support this.
    j
    • 2
    • 7
  • j

    joao.santos

    12/01/2021, 6:33 PM
    Hey guys I have a prisma schema with EXPLICIT MANY TO MANY relation but when I use this:
    Copy code
    const user = await prisma.users.findFirst({
          include: {
            companies: true,
          },
        })
    I get the relation table in "companies" instead of the companie table...
    Copy code
    user {
      id: 1,
      createdAt: 2021-12-01T13:33:47.009Z,
      updatedAt: 2021-12-01T13:33:47.010Z,
      email: '<mailto:user1@users.com|user1@users.com>',
      name: 'User 1',
      lastSeen: null,
      companies: [ { companieId: 1, userId: 1 } ]
    }
    SCHEMA:
    Copy code
    model Users {
      id            Int                   @id @default(autoincrement()) //@default(uuid())
      createdAt     DateTime              @default(now())
      updatedAt     DateTime              @updatedAt
      email         String                @unique
      name          String                @db.VarChar(255)
      lastSeen      DateTime?             @updatedAt
      //RELATIONS
      companies     Companies_Users[]
    }
    
    model Companies {
      id           Int               @id @default(autoincrement()) //@default(uuid())
      createdAt    DateTime          @default(now())
      updatedAt    DateTime          @updatedAt
      name         String            @db.VarChar(255)
      email        String            @unique
      //RELATIONS
      users        Companies_Users[]
    }
    
    model Companies_Users {
      companieId Int
      companie   Companies @relation(fields: [companieId], references: [id], onDelete: Cascade, onUpdate: Cascade)
      userId     Int
      user       Users     @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
    
      @@id([companieId, userId])
      @@map("_Companies_Users")
    }
    Can someone point what Im doing wrong pls?
    m
    • 2
    • 18
  • u

    user

    12/01/2021, 9:25 PM
    TypeScript Berlin Meetup #8 - Magnus Kulke - Type Level Programming (with Dependent Types)

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

    ◭ The presentation wants to dip toes into the weird twilight zone between Types and Values in Typescript. We'll briefly look at the core concept of Dependent Types in Idris and attempt to carry it over to Typescript. We probably won't end up with production-ready code, but maybe we learn something about programming at the type level. ◭ Magnus is working at Mobimeo (Berlin) as an Engineering Manager in the Search domain, helping folks move around sustainably. He enjoys Mobility, Geospatial data, and wrestling with Rust's borrow checker. ◭ Get in touch with Iván: https://github.com/mkulke ◭ Join our TypeScript Berlin Meetup group: https://www.meetup.com/TypeScript-Berlin
  • v

    Vibhuti Gupta

    12/01/2021, 9:40 PM
    Hey guys, has anyone implemented regex search in the arguments using a where clause or something else? Something like this:
    Copy code
    query{
      getUserData(username:"^(hung|dhu)($|[0-9]+$|(_ava|_geo|_com)[0-9]+$|(_c|_val|_previous)$)"){
        name
        email
        username
      }
    }
  • a

    Adrian

    12/01/2021, 10:06 PM
    Is there a way to programmatically generate a schema.prisma file?
    v
    • 2
    • 1
  • a

    Adrian

    12/01/2021, 10:11 PM
    (Besides doing strings magic) :D
  • a

    Adrian

    12/01/2021, 10:15 PM
    I assume the schema.prisma file is transformed into some AST to generate the js client and the other way around when inspecting the Database, it transform the Database schema into the schem.prisma file. Tl;dr I want to transform a json file into schema.prisma
  • d

    Daniel De La Luz

    12/02/2021, 12:37 AM
    Hey team, which is the best practic to have a schema in microservice, that right now I have a schema per microservice, but in it I have to repeat all the models in microservices, its represent future error if lost o forget write model in microservice. someone has an idea. Thank you
    p
    a
    • 3
    • 4
  • s

    satoshi

    12/02/2021, 4:37 AM
    Hi all. I have created a Prisma generator that creates a factory (a function to create data for testing) from schema.prisma. https://github.com/toyamarinyon/prisma-factory-generator I made it in two days, so it’s still lacking some features and documentation, but if anyone is interested in using it, I’d be happy to get feedback! The idea of creating a factory with Prisma generator is based on Chris Ball’s presentation at Prisma Day 2021. discussion: https://github.com/echobind/prisma-factory/discussions/1 presentation:

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

  • a

    Adrian

    12/02/2021, 8:00 AM
    Has anyone ever used TypeORM and Prisma at the same time?
  • p

    Pavel Savva

    12/02/2021, 8:37 AM
    Hey everyone, I apologize if I'm missing something obvious here, but how do I implement something like
    select * from table where lower("columnName") = 'value';
    ? I have an index on
    lower("columnName")
    . I've tried
    where: {
    columnName: {
    equals: 'value',
    mode: 'insensitive'
    }
    }
    , however it results in a full database scan. The documentation links the Postgres page that suggests indexes on
    lower()
    to achieve case insensitive searches, however, I can't figure out how to use
    lower()
    in the
    where
    clause of Prisma find. I'm using Postgres and Prisma 2.
  • j

    joao.santos

    12/02/2021, 11:45 AM
    Hi guys in a graphql resolver is there any way when I not query a relation, prisma doesnt use include in the resolver?
    Copy code
    query users {
      users(clinicNif: 111111111) {
        id
        email
        name
      	companies{
          id
          fiscalName
          fiscalNumber
          email
        }
      }
    }
    whan I do this I get the include, but when I do this:
    Copy code
    query users {
      users(clinicNif: 111111111) {
        id
        email
        name
      }
    }
    The include is not in the query avoiding the 2 table query... I've tried getting this done checking the query in the context, and acting accordingly, but it doesnt work very well... Thx in advanced
    n
    • 2
    • 10
  • d

    Daniell

    12/02/2021, 11:53 AM
    In my prisma seed.ts file I have
    import { config } from "./config"
    which causes
    CustomError: Cannot find module '/workspace/prisma/config' imported from /workspace/prisma/seed.ts
    with the following script:
    Copy code
    "seed": "node --experimental-specifier-resolution=node --loader ts-node/esm ./prisma/seed.ts"
  • a

    Adrian

    12/02/2021, 11:56 AM
    Isn't there some option to make create avoid using "create", "connect" when writing nested entities. It's awkward as fuck to have to process all the input of the rest API to check if it's sending a nested objects and doing the necessary data transformation
    Copy code
    const user = {
      name: 'Max',
      profile: {
        address: 'Frankfurt'
      }
    }
    prisma.user.create(user)
    makes way more sense than
    Copy code
    const user = {
      name: 'Max',
      profile: {
        create: {
          address: 'Frankfurt'
        }
      }
    }
    prisma.user.create(user)
    It's fairly logical that if profile has an "id" (primary key) then it should "connect" the entities instead (exactly what TypeORM does)
1...514515516...637Latest