Questions tagged [prisma]

Prisma is a next-generation Node.js and TypeScript ORM for PostgreSQL, MySQL, SQLite, CockroachDB, MongoDB and SQL Server.

Prisma is a next-generation ORM and can be used in any Node.js or TypeScript backend application (including serverless applications and microservices). This can be a REST API, a GraphQL API a gRPC API, or anything else that needs a database. Use the Prisma client to access your database with Node.js, TypeScript or Go.

Prisma features:

  • An auto-generated and type-safe client library
  • Declarative data modeling and migration system with Prisma Migrate
  • Beautiful data management workflows with Prisma Studio
3236 questions
1
vote
2 answers

Promise that doesn't catch

I was doing some Prisma requests and I noticed that some Promises weren't working. I know I could use async-await, but this should work. prisma .user({ uid }) .then(user => { if (Object.keys(user).length) throw 'error!' return…
JuanM04
  • 27
  • 2
  • 8
1
vote
1 answer

Variable error using Prisma generated code

I'm using createUser generated by Prisma which requires data that expect UserCreateInput. However, i'm having an error. the error Error: Variable '$data' expected value of type 'UserCreateInput!' but got:…
1
vote
0 answers

How to access mongodb local database created by prisma

I have created a db by prisma docker but can't access it via running "mongo" command and it doesn't shows db create by prisma but shows other dbs
TheEhsanSarshar
  • 2,677
  • 22
  • 41
1
vote
1 answer

Prisma-docker could not connect to server

I tried this answer but I get an empty list with ls Problem: I can't connect prisma to an atlas free tier cluster This occurred two times already while setting up graphql server with graphql-yoga and also with apollo-server, so I tried it this time…
LonelyDaoist
  • 665
  • 8
  • 22
1
vote
1 answer

Same type relationships in GraphQL / Prisma

I am trying to create a one-to-many relation of the same type. In this case, a user can report to one user and in turn have many users reporting to them. My data model currently looks like this: type User { id: ID! @id name: String! email:…
Jonny
  • 121
  • 1
  • 5
1
vote
2 answers

How do you make prisma redeploy to a database after you've removed all the tables from the database

I used prisma to generate the schema to a database, but due to changing an id column started getting errors. I deleted the tables and was going to redeploy the schema but I can't find a way to do that. I've already tried doing things like prisma…
Isaac Welch
  • 163
  • 2
  • 9
1
vote
1 answer

Prisma - Sum amount - more than 350’000 rows

I have an Invoice model like: type Invoice { id amount } I have 350'000 invoices. How can I sum amount for all invoices. (Max limitation is 1000) This hack cannot work: https://www.prisma.io/forum/t/query-all-size-limit/557, as I have too…
Alan
  • 9,167
  • 4
  • 52
  • 70
1
vote
2 answers

Having issues with dynamic routes on Next 9

GraphQL queries in my components are not running on dynamic routes when I try to access the query string with router.query.xxx. I have the following file // ./pages/section/[slug].js import { useRouter } from 'next/router'; import AppLayout from…
esausilva
  • 1,964
  • 4
  • 26
  • 54
1
vote
1 answer

Prisma.io How to filter where ENUM field has ANY value

I have a handful of ENUM type fields and I would like to do a where filter where the field value is ANYTHING. Basically, I want is where {fieldName_is_set: true}` Does something like this exist? The only way I can think to do this is: where: {…
Corey Snyder
  • 236
  • 1
  • 3
  • 12
1
vote
1 answer

Prisma: Field ... is not defined in ... input type OR type ... expected but non object was submitted

I'm using Prisma 1.34. fro API development. Testing it through the localhost playground. Sorry for long text in advance, can't understand where I went wrong. I have the following scheme representing hierarchy Script template consist of the Cards…
virtual98
  • 69
  • 3
  • 10
1
vote
0 answers

Prisma resolver query && GraphQL Shield

I am experimenting Prisma GraphQL with GraphQL Shield, btw awesome stuff! Alas I am trying to create a login system using JWT, but I am finding a bottleneck. This will NOT work Mutation: { login: (_, data: UserWhereUniqueInput, ctx) => { …
Rip3rs
  • 1,284
  • 12
  • 21
1
vote
2 answers

Why is my query not returning an array of Enums

I am having some issues with querying an array of Enums in a GraphQL query. I am expecting that the array or permissions will be returned with the user as per the type Bizarrely, when I make the same query in the playground (for either my Prisma or…
Matthew Player
  • 318
  • 4
  • 17
1
vote
1 answer

How to encapsulate data of a type to be specific to the parent type in graphql

I have this game type: type Game { id: ID! @id goals: [Goal] } which have a Goal relationship to: type Goal { id: Int! @id(strategy: SEQUENCE) @sequence(name: "IncID", initialValue: 1, allocationSize: 20) thumbnail: String! player:…
Yassine Bridi
  • 836
  • 2
  • 10
  • 20
1
vote
1 answer

How to secure prisma endpoint deployed to heroku

I deployed prisma PostgreSQL and yoga server to heroku, but the graphql endpoint is public, and anyone can mutate from it. is there a straightforward way of doing it like hasura…
Yassine Bridi
  • 836
  • 2
  • 10
  • 20
1
vote
1 answer

change a related field without mutating the original one

I have this schema: type Game { id: ID! @id status: Boolean @default(value: false) time: DateTime! location: String! stadium: String! teams: [Team!]! @relation(name: "BothTeams") } type Team { id: ID! @id name: String! abbrName:…
Yassine Bridi
  • 836
  • 2
  • 10
  • 20
1 2 3
99
100