Hi Prisma Team! Prisma Migrate just crashed.
| Name | Version |
|-------------|--------------------|
| Platform | darwin |
| Node | v15.0.1 |
| Prisma CLI | 2.10.0 |
| Binary | af1ae11a423edfb5d24092a85be11fa77c5e499c|
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
Thanks for reporting this. It's a known issue in the new release, we are working on it. Would it be possible to share your schema and/or your migrations?
@tomhoule Sorry, I submitted the error without looking for a similar issue first. Here is my schema:
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model Company {
id String @id @default(cuid())
name String
cuit String @unique
customers Company[] @relation("CustomersAndSuppliers")
suppliers Company[] @relation("CustomersAndSuppliers")
employees Employee[]
purchases Transfer[] @relation("CompanyPurchases")
sales Transfer[] @relation("CompanySales")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
enum EmployeeRole {
driver
other
}
model Employee {
id String @id @default(cuid())
firstName String
lastName String
middleName String?
dni String @unique
role EmployeeRole @default(driver)
company Company @relation(fields: [companyId], references: [id])
companyId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Place {
id String @id @default(cuid())
name String
latitude Float
longitude Float
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Transfer {
id String @id @default(cuid())
sourceId String
source Company @relation("CompanyPurchases", fields: [sourceId], references: [id])
destinationId String
destination Company @relation("CompanySales", fields: [destinationId], references: [id])
amount Float
date DateTime
}
The only workaround I could find was deleting the migrations folder, psql mydb and DROP SCHEMA public CASCADE and migrate everything from scratch. But as soon as I update the schema, it fails again.
Great, thanks! A fix is on the way (https://github.com/prisma/prisma-engines/pull/1321) — there should be a patch release of @prisma/cli today, I'll ping this issue when it is out, and you can confirm whether the crash is fixed on your end.
@tomhoule Perfect!, thank you so much for the quick response. Cheers 🍻
2.10.1 was just released — can you confirm the crash doesn't happen anymore with that version?
@tomhoule Yes, I can confirm is now fixed. Thank you so much