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.

`migrate dev` and PostGis Views

See original GitHub issue

Bug description

Hi there, i am having difficulties running prisma migrate dev on a postgres db with postgis installed.

Looking at past issues with PostGis (https://github.com/prisma/prisma/issues/4745), spatial_ref_sys looks like is properly ignored now. But i also have in my database “geometry_columns” and “geography_columns” views which prisma migrate cannot seem to do anything about.

Error: P3016

The fallback method for database resets failed, meaning Migrate could not clean up the database entirely. Original error:
Database error
Error querying the database: db error: ERROR: cannot drop view geography_columns because extension postgis requires it
HINT: You can drop extension postgis instead.
   0: sql_migration_connector::best_effort_reset
           with connection=<connection details>
             at migration-engine/connectors/sql-migration-connector/src/lib.rs:100
   1: migration_core::api::Reset
             at migration-engine/core/src/api.rs:159

Unfortunately i cannot remove the PostGis extension. (ps. i am new to postgis and it is also possible that i have configured PostGis wrongly, as there doesnt seem to be anyone with the same issue)

Is there any place i can define a list of ignored tables / views for migrate?

How to reproduce

  1. With PostGis and related views enabled in database
  2. Run prisma migrate dev

Expected behavior

No response

Prisma information

Running prisma migrate dev --name init

Environment & setup

  • OS: Mac OS
  • Database: PostgreSQL
  • Node.js version: 14.4.0

Prisma Version

"@prisma/client": "^2.25.0"
"prisma": "^2.25.0"

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
tomhoulecommented, Jul 8, 2021

Ok I researched this and geometry_columns and spatial_ref_sys used to be tables, but they are views in newer versions of postgis. We have code to ignore these, it just needs to be extended to views. Working on this.

1reaction
capajcommented, Jul 6, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Chapter 3. PostGIS Administration
Upgrading existing spatial databases can be tricky as it requires replacement or introduction of new PostGIS object definitions. Unfortunately not all ...
Read more >
Making spatial view in PostGIS and adding it as layer in QGIS?
I view is built from the geonames database, loaded into PostGIS. The geoname table/spatial data can be selected/viewed in QGIS just fine. When ......
Read more >
PostgreSQL Migration with Database Migration Service
Check whether all the features that you use in your source databases are available in Cloud SQL for PostgreSQL. For all data-type and...
Read more >
PostGIS For Newbies - Crunchy Data
Refresh your database and you should be able to see the new tables. If you query the streets or neighborhoods and click to...
Read more >
Postgres database versioning and schema migration with Git ...
We use Git and Flyway to automate our schema migrations. It greatly reduces the friction of merging schema changes made by multiple developers...
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