Migrate: Error when running prisma2 migrate save with POSTGRESQL

Created on 28 Mar 2020  路  3Comments  路  Source: prisma/migrate

Bug description


Reason: [migration-engine/connectors/sql-migration-connector/src/lib.rs:237:9] Deserializing the database migration failed.: Error("unknown variant `nextval(\"_Migration_revision_seq\"::regclass)`, expected one of `VALUE`, `NOW`, `SEQUENCE`, `DBGENERATED`", line: 0, column: 0)

How to reproduce

  • run prisma2 migrate save --experimental
  • Expected behavior

    The command should create a new migration.

    Prisma information

    schema.prisma

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

    generator client {
    provider = "prisma-client-js"
    binaryTargets = ["native"]
    }

    model User {
    id String @id @default(cuid())
    email String @unique
    password String
    name String
    role Role @default(USER)
    }

    model Product {
    id String @id @default(cuid())
    name String
    description String
    category Category
    tubeQuantities Int[]
    canQuantities Int[]
    oneLiterQuantities Int[]
    tenLiterQuantities Int[]
    thirtyLiterQuantities Int[]
    oneHundredTwentyLiterQuantities Int[]
    twoHundredTenLiterQuantities Int[]
    }

    enum Role {
    USER
    ADMIN
    }

    enum Category {
    NEUTEC
    AIRTEC
    ALTEC
    SATEC
    SYNTEC
    ZUBEHOER
    }
    ````

    report id

    2367

    Environment & setup

    • OS: Mac OS
    • Database: PostgreSQL
    • Prisma version:
      @prisma/cli : 2.0.0-preview025 Current platform : darwin Query Engine : prisma 8814060fa684793b73d07dbfccd4b7777b3361ae (at /Users/marius/Documents/Projekte/MHS_Technologies/Neutec/neutec-backend/node_modules/@prisma/cli/query-engine-darwin) Migration Engine : migration-engine-cli 8814060fa684793b73d07dbfccd4b7777b3361ae (at /Users/marius/Documents/Projekte/MHS_Technologies/Neutec/neutec-backend/node_modules/@prisma/cli/migration-engine-darwin) Introspection Engine : introspection-core 8814060fa684793b73d07dbfccd4b7777b3361ae (at /Users/marius/Documents/Projekte/MHS_Technologies/Neutec/neutec-backend/node_modules/@prisma/cli/introspection-engine-darwin)
    • Node.js version: v13.7.0

    Most helpful comment

    Can confirm that deleting the migration folder and content of the "_Migration" table in the database resolves this problem - just deleting the folder was not enough. I guess that makes sense though.

    Edit: I should add that you will not lose any data by doing this.

    All 3 comments

    There was a change in introspection that caused the saved migrations format to break - we hadn't detected that before so it's not in the release notes, I think that if you delete your migrations folder and apply migrate again, the problem should go away. Sorry for the breakage!

    Can confirm that deleting the migration folder and content of the "_Migration" table in the database resolves this problem - just deleting the folder was not enough. I guess that makes sense though.

    Edit: I should add that you will not lose any data by doing this.

    Can confirm that deleting the migration folder and content of the "_Migration" table in the database resolves this problem - just deleting the folder was not enough.

    Can confirm this too, now everything works as expected.
    Thank you for your help!

    Was this page helpful?
    0 / 5 - 0 ratings

    Related issues

    nickreynke picture nickreynke  路  4Comments

    2013-11390 picture 2013-11390  路  3Comments

    chanphiromsok picture chanphiromsok  路  3Comments

    julien1619 picture julien1619  路  3Comments

    agryaznov picture agryaznov  路  3Comments