Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mitigate confusion and errors resulting from Prisma's Shadow DB 😈 #2091

Open
thedavidprice opened this issue Mar 24, 2021 · 5 comments
Open

Comments

@thedavidprice
Copy link
Contributor

thedavidprice commented Mar 24, 2021

I'm seeing more questions, issues, and errors resulting from confusion about Prisma Migrate's new Shadow DB. (Additionally, we have some similar confusion regarding Redwood's local Test DB requirements in case of switching off SQLite).

For context, see my answer to Thomas in the Forums: https://community.redwoodjs.com/t/creating-a-startup-support-crew/1805/38

Questions/Ideas

  • where and how can we improve documentation + instructions about this
  • is there any internal checks we can add to catch this in advance?
    • maybe Prisma could create a command to check if Shadow DB status == ok. We could run as part of flow and prompt with instructions if not ok
  • need to improve feedback loop with Prisma so they share in "feeling the pain"

Update

Help wanted --> see this comment re: next step auditing the current experience.

@jtoar
Copy link
Contributor

jtoar commented Dec 13, 2021

@thedavidprice I hardly remembered that the shadow db is a thing. Do you think this is still a concern?

@jtoar
Copy link
Contributor

jtoar commented Dec 17, 2021

@thedavidprice I'm going to close this one but feel free to re-open if you think we should address this for v1.

@jtoar jtoar closed this as completed Dec 17, 2021
@thedavidprice thedavidprice reopened this Dec 22, 2021
@thedavidprice
Copy link
Contributor Author

@jtoar Re-opening this one — I'd like us to first audit the experience in the case where:

  • user sets only DATABASE_URL connection string to a cloud-hosted DB
  • then runs Prisma migrate commands

What happens? And is the resulting error clear about needing a second DB and how to set it up?

If the experience is adequate, then I'd say let's close it out.

@simoncrypta simoncrypta self-assigned this Aug 27, 2022
@simoncrypta
Copy link
Collaborator

We get the following error :

Error: P3014

Prisma Migrate could not create the shadow database. Please make sure the database user has permission to create databases. Read more about the shadow database (and workarounds) at https://pris.ly/d/migrate-shadow

Original error: 
db error: ERROR: permission denied to create database
   0: migration_core::state::DevDiagnostic
             at migration-engine/core/src/state.rs:250

The Prisma doc give a workaround by creating a dedicate shadow database from a cloud-hosted DB,

datasource db {
  provider          = "postgresql"
  url               = env("DATABASE_URL")
  shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
}

@thedavidprice I think the experience is adequate, we can maybe still add it to our doc as a head-up somewhere in this part : https://redwoodjs.com/docs/deploy/introduction#3-prisma-and-database

@jtoar
Copy link
Contributor

jtoar commented Jan 29, 2023

Latest example of this is #5767.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Triage
Development

No branches or pull requests

3 participants