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.

I can't migrate PostGIS tables..

See original GitHub issue

Bug description

I think that verifying with shadow database failed because migrate tools drop table spatial_ref_sys so public.geometry does not exist…

How to reproduce

1.make schema with geo table

generator client {
  provider = "prisma-client-js"
}

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

model Geom {
  geomId    Int                                                    @id @default(autoincrement())
  geomData  Unsupported("\"public\".geometry(multipolygon, 4326)")
  createdAt DateTime                                               @default(now()) @db.Timestamptz
  updatedAt DateTime                                               @updatedAt @db.Timestamptz
}
  1. npx prisma migrate --name init

  2. modify schema schema.prisma

...
model test {
  id  Int @id @default(autoincrement())
}
  1. again npx prisma migrate --name add_test_table

Expected behavior

working well!

Prisma information

Error: P3006

Migration `20220503113444_add_geom` failed to apply cleanly to the shadow database. 
Error:
db error: ERROR: type "public.geometry" does not exist
   0: sql_migration_connector::validate_migrations
             at migration-engine/connectors/sql-migration-connector/src/lib.rs:272
   1: migration_core::state::DevDiagnostic
             at migration-engine/core/src/state.rs:250

Environment & setup

  • OS: Mac Os
  • Database: Postgresql with PostGIS
  • Node.js version: 16

Prisma Version

prisma                  : 3.13.0
@prisma/client          : 3.13.0
Current platform        : darwin
Query Engine (Node-API) : libquery-engine efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine        : migration-engine-cli efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine    : introspection-core efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary           : prisma-fmt efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash    : efdf9b1183dddfd4258cd181a72125755215ab7b
Studio                  : 0.459.0

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
janpiocommented, May 18, 2022

Can you maybe open a quick new issue with just your reproduction? That would make it easier for us to reproduce and discuss. Thanks.

1reaction
sauloaguiarcommented, May 4, 2022

@janpio suggestion worked for me!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrating PostgreSQL table with Lat Lon columns to existing ...
Let's assume that your 'deg' columns are +ve for North/East and -ve for South/West, and that all other metrics are +ve only, ...
Read more >
Do not drop PostGIS table · Issue #76 · prisma/migrate - GitHub
PostGIS requires spatial_ref_sys table which Prisma is trying to drop when performing the initial migration.
Read more >
Chapter 3. PostGIS Administration
5) load the PostGIS functions into a template database called template_postgis . If the template_postgis database exists in your PostgreSQL installation then it ......
Read more >
postgres, cannot see table data after migration - Stack Overflow
After I've migrated a table from another database I cannot see the data in the postgres table. With \d I can see the...
Read more >
Preparing PostgreSQL for migration with Database Migration ...
If you're worried about the data in that table changing during the migration, you can copy the data over right before promoting the...
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