unable to run migrations in an empty PostGIS db
See original GitHub issueBug description
Copied from https://github.com/prisma/prisma/discussions/4732
I’m struggling to use the migration tool after I upgraded to 2.13.0. I have a few spatial columns that I manage with scripts besides the Prisma migration tool.
My pipeline used to be this:
- apply Prisma migrations
- run manual migrations and add / alter spatial columns if needed
but with 2.13.0, I can no longer run any Prisma migration on a fresh PostGIS database because of this error:
Error: P3005
The database schema for `localhost:5432` is not empty. Read more about how to baseline an existing production database: https://pris.ly/d/migrate-baseline
Enabling PostGIS creates a spatial_ref_sys
table, so technically the database is not empty, but it should not affect migrations.
I know Prisma does not yet support the PostGIS extension, but I’m looking for a workaround.
I’m also a Nexus and nexus-plugin-prisma user which doesn’t support 2.12.x, so I can’t downgrade reliably.
How to reproduce
Steps to reproduce the behavior:
- Have an empty PostGIS database (I used https://hub.docker.com/r/postgis/postgis)
- Run
prisma migrate dev --preview-feature
- See error
Expected behavior
Migrations run without an error.
Environment & setup
- OS: PopOS
- Database: PostgreSQL with PostGIS
- Node.js version: v14.13.0
- Prisma version:
@prisma/cli : 2.13.0
@prisma/client : 2.13.0
Current platform : debian-openssl-1.1.x
Query Engine : query-engine 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/query-engine-debian-openssl-1.1.x)
Migration Engine : migration-engine-cli 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary : prisma-fmt 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Studio : 0.329.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Django migrations failing with fresh database - Stack Overflow
I set up my new database, add it to my settings, and run python manage.py migrate; I get a SQL error telling me...
Read more >Troubleshooting migration tasks in AWS Database Migration ...
Troubleshoot issues when migrating data using AWS Database Migration ... You can pull data once from a view; you can't use it for...
Read more >Migration Operations - Django documentation
If you need an empty migration file to write your own Operation objects into, use python manage.py makemigrations --empty yourappname , but be...
Read more >[Solved]-Unable to apply Django migration in Postgres DB-postgresql
Firstly, Create a migration file to add NULLABLE column without default value. Secondly, Create an empty migration that fill this new empty value...
Read more >Prisma Migrate limitations and known issues
Run prisma migrate dev to start a new migration history. The last step creates a new initial migration that goes from an empty...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should be fixed by https://github.com/prisma/prisma-engines/pull/1478, to be released tomorrow.
I can confirm this after running the
create extension if not exists "postgis";
I think we should ignore this table