prisma: Failed to do prisma db:push : VT13001: [BUG] in scatter query
Bug description
Error: P3016
The fallback method for database resets failed, meaning Migrate could not clean up the database entirely. Original error:
VT13001: [BUG] in scatter query: complex ORDER BY expression: case when table_info.create_options = :table_info_create_options /* VARCHAR */ then true else false end
0: sql_migration_connector::flavour::mysql::connection::describe_schema
The fallback method for database resets failed, meaning Migrate could not clean up the database entirely. Original error:
VT13001: [BUG] in scatter query: complex ORDER BY expression: case when table_info.create_options = :table_info_create_options /* VARCHAR */ then true else false end
0: sql_migration_connector::flavour::mysql::connection::describe_schema
at migration-engine\connectors\sql-migration-connector\src\flavour\mysql\connection.rs:34
1: sql_migration_connector::best_effort_reset
with namespaces=None
at migration-engine\connectors\sql-migration-connector\src\lib.rs:333
2: migration_core::state::Reset
at migration-engine\core\src\state.rs:425
How to reproduce
prisma db:push
Expected behavior
It had no errors until today. He expected the tables to be turned up
Prisma information
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
enum Lang {
en
es
}
enum InsuranceType {
car
life
health
}
enum PartnerSituationOptions {
single
divorced
married
concubined
}
enum CivilStatusOptions {
soltero
divorciado
casado
concubino
}
enum Gender {
masculino
femenino
otro
}
enum RoleConvertation {
system
user
assistant
}
model User {
id Int @id @default(autoincrement())
familyProfiling FamilyProfiling?
financialProfiling FinancialProfiling?
firstName String @map("first_name")
lastName String @map("last_name")
email String @unique
password String?
pin Int?
avatarUrl String? @map("avatar_url")
age String?
phone String?
// partnerSituation PartnerSituationOptions? @map("partner_situation")
// numberOfKids Int? @map("number_of_kids")
// monthlySalary Int? @map("monthly_salary")
messengerSessionId String? @unique @map("messenger_session_id")
whatsappSessionId String? @unique @map("whatsapp_session_id")
appSessionId String? @unique @map("app_session_id")
otherSessionId String? @unique @map("other_session_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
@@index([id, email, messengerSessionId, whatsappSessionId, appSessionId])
@@map("users")
}
model FamilyProfiling {
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId Int @unique
gender Gender? @map("gender")
numberOfkids Int? @map("number_of_kids")
numberOfpets Int? @map("number_of_pets")
civilStatus CivilStatusOptions? @map("civil_status")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
@@map("family_profiling")
}
model FinancialProfiling {
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId Int @unique
employment Boolean? @map("employment")
typeEmployment String? @map("type_employment")
monthlySalary Int? @map("monthly_salary")
employmentActivities String? @map("employment_activities")
ownCar Boolean? @map("own_car")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
@@map("financial_profiling")
}
model DemoInsurance {
id Int @id @default(autoincrement())
name String
type InsuranceType
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
@@index([id])
@@map("demo_insurances")
}
model Convertation {
id Int @id @default(autoincrement())
role RoleConvertation
content String? @default("")
rank Int
senderMessengerId String? @map("sender_messenger_id")
senderWhatsappId String? @map("sender_whatsapp_id")
senderAppId String? @map("sender_app_id")
senderOtherId String? @map("sender_other_id")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
@@index([id, senderMessengerId, senderWhatsappId, senderAppId, senderOtherId])
@@map("conversations")
}
Environment & setup
- OS: Windows
- Database: PlanetScale
- Node.js version: 18.5.0
Prisma Version
4.11.0
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (5 by maintainers)
Hey guys greetings!
@ManuelAlberto32 i countered an error like u do, i fixed it simply by clearing all the prisma package first and then i reinstall it with the latest version
hopes this will help!
I confirm this works.
How are you! Great it works for me and next to this I just added
relationMode="prisma"
and it was solved. Thank you very much for taking the time to support me guys. 🙌🏻✨shadowDatabaseUrl
only affectsmigrate dev
- and will create a SQL file that you can share with us so we know what SQLdb push
executes under the hood. So please try to run that and share the result here.It would just be a second, temporary database that you create. (We know this is complex, and as Planetscale handles migrations themselves and has this limitation, we usually do not recommend do use
migrate dev
with them - in this case this is just so you can get the SQL thatdb push
runs under the hood. Here is some more information)