Questions tagged [prisma-graphql]

Prisma turns your database into a GraphQL API.

Prisma lets you design your data model and have a production ready GraphQL API online in minutes.

The Prisma GraphQL API provides powerful abstractions and building blocks to develop flexible, scalable GraphQL backends.

416 questions
30
votes
7 answers

prisma - getting environment variable not found error message when running graphql query

I am getting this error message from prisma when I am running the GraphQL query. Environment variable not found: DATABASE_URL.\n --> schema.prisma:6\n | \n 5 | provider = \"postgresql\"\n 6 | url = env(\"DATABASE_URL\")\n |…
Sumchans
  • 3,088
  • 6
  • 32
  • 59
27
votes
4 answers

How to upsert new record in Prisma without an ID?

I'm using Prisma (https://www.prisma.io) as ORM. I want to check for duplicates when store data and, if not exists, create a new record. I thought I could do that with upsert method provided by Prisma and available in the generated client, but the…
24
votes
3 answers

docker and mysql: Got an error reading communication packets

I have a problem with connectivity in docker. I use an official mysql 5.7 image and Prisma server. When I start it via prisma cli, that uses docker compose underneath (described here) everything works. But I need to start this containers…
Terion
  • 2,396
  • 3
  • 28
  • 42
21
votes
13 answers

"Property does not exist" when I want to use model added in Prisma.schema

I'm working on ReactJS project with NextJS Framework and Prisma to manage connection and queries to the DB. On my local project the Support model is found and when I use it in my API and build my project it's ok. But when I push my project on…
Peter
  • 263
  • 1
  • 3
  • 7
19
votes
3 answers

I want to use multiple database in prisma orm

I am not able to use multiple database in same application . How can we use multiple data sources. Can we generate multiple "schema.prisma" for different database connections.
19
votes
2 answers

How can I execute mutation in GraphQL playground?

My Goal: I want to execute a mutation in GraphQL Playground. My schema looks the following: type Mutation { # Add a new comment addComment(comment: InputComment!): Comment } # Input type for a new Comment input InputComment { # The…
B. Wasnie
  • 541
  • 1
  • 4
  • 12
17
votes
1 answer

What does 'locations' refer to in GraphQL errors?

I'm working through a GraphQL Node/Prisma server tutorial and encountered an error due to something wrong in my code. I've solved the error but I want to understand the error message, in particular, what does locations refers to? That is, I have a…
Cerulean
  • 5,543
  • 9
  • 59
  • 111
15
votes
5 answers

Prisma many-to-many relations: create and connect

In my Prisma schema, I have a many-to-many relationship between posts and categories. I've added @map options to match the Postgres snake_case naming convention: model Post { id Int @id @default(autoincrement()) title …
Johnny Oshika
  • 54,741
  • 40
  • 181
  • 275
15
votes
2 answers

Ordering by multiple columns in Prisma

I know currently Prisma doesn't support ordering by multiple scalars fields, (see this issue: https://github.com/prisma/prisma/issues/62). But, I'm wondering if there is someone who found a solution to work around this issue without using executeRaw…
Andrei Bacescu
  • 569
  • 1
  • 5
  • 11
12
votes
6 answers

Supabase client permission denied for schema public

Whenever I've try to use @supabase/supabase-js to query the db, I get an error. error: { hint: null, details: null, code: '42501', message: 'permission denied for schema public' } I think it has something to do with Prisma, which I…
rdavis
  • 143
  • 1
  • 1
  • 5
11
votes
1 answer

Prisma - How to define compound unique constraint with fields in multiple models?

I have this not so straightforward model relationship in Prisma. User --< Enrollment >-- Course and I can't figure out how to ensure the Course title field is unique just among that user's created courses. In other words, I dont want one user to…
TemuujinNat
  • 135
  • 1
  • 1
  • 7
11
votes
5 answers

prisma findUnique where takes only one unique argument

I ran into an issue where I need to check if a user exists by his username and email since both are unique fields in the database, but I got an error. Argument where of type UserWhereUniqueInput needs exactly one argument, but you provided username…
ahmdtalat
  • 149
  • 1
  • 1
  • 7
9
votes
1 answer

prisma2: how to fetch nested fields?

In prisma 1 I have used fragment to fetch the nested fields. For example: const mutations = { async createPost(_, args, ctx) { const user = await loginChecker(ctx); const post = await prisma.post .create({ data: { …
Ashik
  • 2,888
  • 8
  • 28
  • 53
8
votes
2 answers

How to use DECIMAL(10,2) in prisma migrate tool?

I need save DECIMAL(10,2) in database. In MySQL there is DECIMAL type. MySQL docs: https://dev.mysql.com/doc/refman/8.0/en/fixed-point-types.html Prisma 2.0 docs: https://www.prisma.io/docs/reference/database-connectors/mysql Possible Prisma…
Daniel
  • 7,684
  • 7
  • 52
  • 76
8
votes
2 answers

'prisma' is not recognized as an internal or external command, operable program or batch file

Hi everyone I am getting this error "'prisma' is not recognized as an internal or external command, operable program or batch file." while running prisma login command in cmd I have installed the prisma globally with npm install -g prisma any…
Ezatla
  • 115
  • 1
  • 1
  • 7
1
2 3
27 28