Skip to content

unable to run migrations in an empty PostGIS db #4745

@benknab

Description

@benknab

Bug description

Copied from #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:

  1. apply Prisma migrations
  2. 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:

  1. Have an empty PostGIS database (I used https://hub.docker.com/r/postgis/postgis)
  2. Run prisma migrate dev --preview-feature
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/2-confirmedBug has been reproduced and confirmed.kind/bugA reported bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions