Migrate: Crash Report

Created on 27 Oct 2020  路  10Comments  路  Source: prisma/migrate

Hi Prisma Team! Prisma Migrate just crashed.

Command: npx prisma migrate save --experimental

Versions

| Name | Version |
|-------------|--------------------|
| Platform | darwin |
| Node | v10.22.1 |
| Prisma CLI | 2.10.0 |
| Binary | af1ae11a423edfb5d24092a85be11fa77c5e499c|

Error

Error: Error in migration engine.
Reason: [libs/sql-schema-describer/src/walkers.rs:214:27] index out of bounds: the len is 0 but the index is 0

Please create an issue in the migrate repo with
your `schema.prisma` and the prisma command you tried to use 馃檹:
https://github.com/prisma/migrate/issues/new

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

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

model User {
  id         Int       @id @default(autoincrement())
  firstName  String
  lastName   String
  email      String    @unique
  password   String
  messages   Message[]
  createdAt  DateTime  @default(now())
  updatedAt  DateTime  @updatedAt
}

model Message {
  id          Int      @id @default(autoincrement())
  body        String
  author      User     @relation(fields: [authorId], references: [id])
  recipient   User     @relation("recipient", fields: [recipientId], references: [id])
  authorId    Int      // relation scalar field  (used in the `@relation` attribute above)
  recipientId Int      // relation scalar field  (used in the `@relation` attribute above)
  createdAt   DateTime @default(now())
  updatedAt   DateTime @updatedAt
}

Downgrade to Prisma CLI 2.9.0 resolved issue

All 10 comments

Same after upgrading from 2.9.0 to 2.10.0

@sethbrasile I haven't been able to reproduce the crash with the schema you posted, do you have more context on how this happened? What sequence this was migrated in?

@kevrat could you share more context?

@sethbrasile I haven't been able to reproduce the crash with the schema you posted, do you have more context on how this happened? What sequence this was migrated in?

@kevrat could you share more context?

Just removed ./migrations and postgres db, recreate the db and the error went away

do you have a copy of the migrations folder before you removed it? It would help investigate the bug.

do you have a copy of the migrations folder before you removed it? It would help investigate the bug.

Unfortunately, I am don't commit the migrations folder yet

I will attempt to recreate. If I recall correctly, I was receiving this error even with an empty/missing migrations folder. I believe I tried removing the existing migrations and resetting the db before I downgraded.

I did commit the migrations folder, so I do believe I have the state of the migrations folder in a commit. Not certain though. This is the start of a new project so it is hopefully in the initial commit.

There has been refactoring in that area of the codebase recently and there is generally a lot of work happening on migrate at the moment, so I am not surprised something broke. If it's possible, having that reproduction would really help figure things out, since I haven't been able to reproduce the problem in tests nor with manual testing. It's a pretty core part of migrate so it will be fixed soon regardless, but the reproduction would help. Thanks :)

We just released 2.10.1 with the fix. Can you confirm the crash does not happen anymore on your end?

@tomhoule Have not seen it since I upgraded.

Upgraded from 2.9.0 to 2.10.0, deleted migrations folder, deleted db, was able to save and up initial migration without error.

Added one field to one model. Ran npx prisma migrate save --experimental again, received same crash as original post.

Upgraded to 2.10.1, was able to save and up without error! I believe this is resolved! Thank you!

Was this page helpful?
0 / 5 - 0 ratings