Git Product home page Git Product logo

prisma-relation-panic's Introduction

  1. Create a .env file with DATABASE_URL=YOUR_CONNECTION_STRING_HERE using MySQL
  2. npm i
  3. npm run init to push the schema to the database

Observe the panic:

  1. npm run seed:fail to run prisma/fail.ts
  2. npm run start to run index.ts
/Users/prisma/Code/prisma-relation-panic/node_modules/@prisma/client/runtime/index.js:39822
        throw new PrismaClientUnknownRequestError(message, this.client._clientVersion);
              ^
PrismaClientUnknownRequestError: 
Invalid `prisma.a.findMany()` invocation in
/Users/prisma/Code/prisma-relation-panic/index.ts:8:33

   5 })
   6 
   7 async function main() {
โ†’  8   const result = await prisma.a.findMany(
  called `Option::unwrap()` on a `None` value
    at Object.request (/Users/prisma/Code/prisma-relation-panic/node_modules/@prisma/client/runtime/index.js:39822:15)
    at async PrismaClient._request (/Users/prisma/Code/prisma-relation-panic/node_modules/@prisma/client/runtime/index.js:40646:18)
    at async main (/Users/prisma/Code/prisma-relation-panic/index.ts:8:18) {
  clientVersion: '3.11.0'
}

To test data-driven resolution:

  1. npm run seed:succeed
  2. npm run start

Notes:

  1. After Prisma version 3.11 npx prisma db seed will throw an opaque error when the schema includes references to non-unique values:
An error occured while running the seed command:
Error: Command was killed with SIGKILL (Forced termination): ts-node prisma/seed.ts
  1. The SQLite connector catches this error on npx prisma db push:
Error: P1012

error: Error validating: The argument `references` must refer to a unique criteria in the related model `A`. But it is referencing the following fields that are not a unique criteria: custom_id
  -->  schema.prisma:21

prisma-relation-panic's People

Contributors

andrewicarlson avatar

Watchers

 avatar  avatar

Forkers

janpio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.