Prisma Migrate: Error creating shadow database
Problem
Problem Users run into this issue if their database user has no privileges to create databases (MySQL / Postgres). This happens because Migrate tries to create a shadow database under the hood. [code block] Some of the situations where this might be the case: Running DBMS locally but user has insufficient privileges -> Possible resolution: grant privileges. We should improve the user-facing error and document this properly Using a cloud-hosted DB for development, where creating additional databases is probably not supported -> Possible resolution: make the shadow DB URL configurable Additional context * Slack conversation with user on Heroku
Error Output
ERROR: relation "_prisma_migrations" does not exist at character 126
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Prisma Migrate: Error creating shadow database
For anyone like me who is a newbie to databases and who are using a cloud-hosted db for development, you can fix by doing the following: 1. Set up a local db. I am using PostgreSQL and followed this guide: https://www.codementor.io/@engineerapart/getting-started-with-postgresql-on-mac-osx-are8jcopb 2. Change your prisma .env file to local db 3. Delete prisma/migrations folder 4. Run `npx prisma m
Trust Score
8 verifications
- 1
For anyone like me who is a newbie to databases and who are using a cloud-hosted
For anyone like me who is a newbie to databases and who are using a cloud-hosted db for development, you can fix by doing the following:
- 2
Set up a local db. I am using PostgreSQL and followed this guide: https://www.co
2. Change your prisma .env file to local db 3. Delete prisma/migrations folder 4. Run `npx prisma migrate dev --preview-feature` to start a new migration 5. Change your prisma .env file back to development db 6. Run `npx prisma migrate resolve --applied "{{MIGRATION_FOLDER_NAME_GENERATED_BY_STEP_4}}" --preview-feature`
Validation
Resolved in prisma/prisma GitHub issue #4571. Community reactions: 64 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep