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
prisma migrate dev
fails with P3005 error on second run (empty db)
#19234
Comments
prisma migrate dev
Fails with P3005 Error on Second Run
prisma migrate dev
Fails with P3005 Error on Second Runprisma migrate dev
fails with P3005 Error on Second Run
prisma migrate dev
fails with P3005 Error on Second Runprisma migrate dev
fails with P3005 error on second run (empty db)
happens to be that it fails with this config:
and doesnt fail like this:
so the issue is somewhere in
|
if i do
|
Same here! Also I run |
I also have this issue (works fine without |
It's not a bug. The issue is that you're using the same DB as a
https://www.prisma.io/docs/concepts/components/prisma-migrate/shadow-database |
@charliewhu @tomi-mercado @di-sukharev Please see @AgileNix' comment, they are correct. With the same database URL for both Seems we have to prioritize this issue soon: #16628 Where did you get your Prisma schema I suggest you remove the |
@janpio yep, it was vercel postgres with prisma default setup |
Bumping this, also setup using the "beta" Vercel postgres setup |
The Vercel Postgres + Prisma starter repo should be updated, I got around the error by creating a shadow database directly on Neon (https://neon.tech) and adding a new env variable pointing to it:
|
My solution to this is instead use the postgres server as the shadowDatabaseUrl
assuming you setup your DATABASE_URL as your local db's url |
@janpio Thanks for great info. Can I ask if there are any downsides to removing the shadow database URL? |
No, it is only supposed to be used if the shadow database can not be created automatically. If your database allows that, you should not use |
Also bumping this. Even when removing the shadowDatabaseUrl I'm still getting the same error. |
Can you open a new issue and fill all the information the template asks for @shimekukuri? That should not be happening and does not match what others are reporting here, so we would like to investigate. Thanks. |
Ran into this, many hours wasted. Thanks for soln. |
Hey everyone, Vercel Postgres now supports Prisma Migrate better, so you can remove the Can you please let me know if this works for you? Then we can push to get the documentation updated accordingly. Thanks! |
Removed 'shadowDatabaseUrl' for migration on vercel. Prisma docs stated that 'shadowDatabaseUrl' shouldn't be the same as 'directUrl'; as it causes errors. Prisma Docs: https://www.prisma.io/docs/concepts/components/prisma-migrate/shadow-database Potential Problem regarding migration: prisma/prisma#19234 (comment)
This is now fixed. Do not use |
I ran into issues with the `prisma migrate` command: ``` Error: P3005 The database schema is not empty. ``` After some research, I was able to resolve the issue by removing the `shadowDatabaseUrl` from `schema.prisma`. > Important: Do not use the same values for url and shadowDatabaseUrl. https://www.prisma.io/docs/concepts/components/prisma-migrate/shadow-database > Do _not_ use `shadowDatabaseUrl` with Vercel Postgres any more, > especially not with the same value as `url` or `directUrl`. > The shadow database can be created dynamically. prisma/prisma#19234 (comment) See prisma/prisma#19234
Removes the shadow database URL to fix the bugs once migrations are introduced. See [shadow database documentation](https://www.prisma.io/docs/concepts/components/prisma-migrate/shadow-database) and prisma/prisma#19234 (comment). > Important: Do not use the same values for directUrl and shadowDatabaseUrl.
prisma/prisma#19234 こちらのエラー解決法に則って。
* Working admin, broken views * reset schema to accomodate max flexibility using json field type * Refactor db schema to accomodate max flexibility using json fields * create views from user-submitted data from which to create UI elements in front-end * Auto-generate ERD diagram * reinstate theme table (instead of view) * update views * annotate tables * remove optional nature of study slug * convert metrics id into compound id * convert metrics_metadata id into composite id and add map_display index * remove unnecessary index * add missing index to geometries table * continue removing unnecessary index specifications * Add step to lint codebase for unstaged ERDs * Update ERD * Upload failed prisma builds * Use slugs rather than IDs, refactor * Clarify terminology in readme * Refine models * Add prototyping data * Continue example queries * More examples * Add functions and seed Still just for dev, need to be moved to migration and seed.ts * Rm schema * Rm shadowDatabaseUrl As per prisma/prisma#19234 (comment) * Create migration for updated models * Create migration for functions * Working start to seed * Undo admin logic * Revert "Working admin, broken views" This reverts commit 332a54a. * Cleanup * Cascade deletes, delete study before ingestion * Squash migrations * Update log * Stage progress * Refine * Update to store src_field in aggregations * Add pre-aggregation to ingestion * Add units & description to aggregations * Change term * Rename field * Continue buildout * Working ingestion * Add ingestion data * Disable ERD generation * Update model to fit new DB schema * Update spatial queries * Fix build * Fix attribute name * Tighten typings to avoid build issues * Reference origin for tile host * Delete prisma/views/public/vw_map_fields.sql * Delete seed.sql * Cleanup ERD generation * Add migration to relate themes with scenarios * Support theme_scenario through table * Fixup app data model * Add ERD dependency * Re-activate scenario control * Update ERD * Slim down data * Simplify * Update README.md * Disable buggy ERD generation * Cleanup * Avoid creating theme_scenario for baseline scenario * Avoid global window error * Fix geo data * Apply suggestions from code review Co-authored-by: Tammo Feldmann <31222040+Tammo-Feldmann@users.noreply.github.com> * Cleanup SQL * Delete .github/workflows/lint.yaml --------- Co-authored-by: Emma Paz <emma@developmentseed.org> Co-authored-by: Tammo Feldmann <31222040+Tammo-Feldmann@users.noreply.github.com>
Bug description
When running
npx prisma migrate dev
for the second time on a non-empty database, the command fails with the errorand the
__prisma_migrations
table gets deleted.Checked that I am using the latest version of Prisma.
Enabled debug logs and checked them for more detailed error messages.
Reset the development database using
npx prisma migrate reset
.Checked that the Prisma schema and database schema are in sync.
Manually dropped and recreated the database.
Validated the database connection using other tools.
Reinstalled node modules.
None of these steps resolved the issue.
How to reproduce
Initialize a new Prisma project with a new database.
Run npx prisma migrate dev - this works as expected.
Run npx prisma migrate dev a second time - this results in the Error: P3005 The database schema is not empty.
Expected behavior
npx prisma migrate dev
should be able to be run multiple times without errors, as long as the Prisma schema has not changed.Prisma information
Environment & setup
Prisma Version
Full error log
The text was updated successfully, but these errors were encountered: