question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lift and Photon search for database in different folders

See original GitHub issue

Given a schema

datasource db {
  provider = env("PRISMA_PROVIDER")
  url      = env("PRISMA_URL")
}

generator photon {
  provider = "photonjs"
}

model Role {
  id    String @default(cuid()) @id
  role  String @unique
}

and package.json

{
  "private": true,
  "scripts": {

    "dev": "PRISMA_PROVIDER=sqlite PRISMA_URL=file:./dev.db prisma2 dev",
    "seed": "PRISMA_PROVIDER=sqlite PRISMA_URL=file:./dev.db ts-node prisma/seed.ts"
  },
  "dependencies": {
    "prisma2": "^2.0.0-preview-6.1",
    "ts-node": "^8.3.0",
    "typescript": "^3.5.3"
  }
}

and seeding script

import Photon from "@generated/photon";

new Photon().roles
  .create({
    data: {
      role: "DEFAULT"
    }
  })
  .then(console.log)
  .catch(console.error)
  .finally(() => process.exit());

when I run prisma2 dev and seed script

yarn dev
yarn seed

I see an error

Invalid `photon.()` invocation in /Users/roman.paradeev/workspace/photon-tslint-bug/prisma/seed.ts:4:4
Reason: Error in connector: Error querying the database: no such table: dev.Role

and I see two databases created.

  • <project root>/prisma/dev.db created by prisma2 dev
  • <project root>/dev.db created by ts-node prisma/seed.ts

When I change PRISMA_URL for seed script

    "dev": "PRISMA_PROVIDER=sqlite PRISMA_URL=\"file:./dev.db\" prisma2 dev",
    "seed": "PRISMA_PROVIDER=sqlite PRISMA_URL=\"file:./prisma/dev.db\" ts-node prisma/seed.ts"

seeding script runs without errors.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

4reactions
timsuchanekcommented, Sep 13, 2019

My apologies, a package wasn’t updated properly. It’s fixed now in prisma2@2.0.0-alpha.185.

1reaction
pantharshit00commented, Aug 14, 2019

Yes, I agree with this

Read more comments on GitHub >

github_iconTop Results From Across the Web

Type-safe Database Access & Declarative Migrations | Prisma 2 ...
We are excited to share the Prisma 2 Preview today. It features a type-safe database client (Photon) and a declarative migration system (Lift)....
Read more >
How to use Find and Locate in Linux - Cyber Photon
Is much faster, but uses an 'older' database and searches only names or parts of them. ... But each of them work in...
Read more >
Prisma 2.0.0-preview-11 Release - GitClear
237 Diff Delta ... Browse Other Releases ... Lift and Photon search for database in different folders · Upload introspection engine binary to...
Read more >
Building a Habit Tracker with Prisma 2, Chakra UI, and React
Prisma unifies access to multiple databases at once (coming soon) and therefore ... We find the habit by calling ctx.photon.habits.
Read more >
Getting Started with Databricks SQL Analytics
You can put loads of just interesting data in there, which you can't really do if you're working in relational environment. And so...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found