New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL does not support onDelete: setDefault
#11498
Comments
Seems to already be a validation with preview feature |
What exact MySQL version you are running? |
My output was from a |
Yeah, whatever MySQL version we were using in the time of the writing of our docs silently just did not use the given action. This might've changed in a point release, as we know MySQL does this between |
Prisma supports only InnoDB, so essentially does not support |
If we say we only support InnoDB, I'm OK validating against using |
I think it's the current reality when you create a schema via Migrate. As we do not have the table engine information in the schema (yet, there might be an issue floating around) I think this is the easiest option right now. |
TODO check if it works with MySQL 8 (and not in 5.7) like mentioned in prisma/prisma-engines#2957 |
Considering that we only support |
The linked issue is a different topic, please pull in the relevant information that describes the support of |
I confirm that
|
Decision: Document that |
Closing in favor of docs issue prisma/docs#3885 |
I have summarised my findings in this internal notion doc. |
We have realized that providing support for the datasource db {
provider = "postgres"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
posts Post[]
}
model Post {
id Int @id @default(autoincrement())
user User? @relation(fields: [userId], references: [id], onUpdate: SetDefault, onDelete: SetDefault)
userId Int? @default(3)
} The MySQL docs claim that table definitions with |
Closing this issue in favor of #16259, which will implement warnings in this issue's scenarios, as to avoid breaking changes. |
When trying to migrate a super simple schema to MySQL with an
onDelete: setDefault
, this happens:Per our documentation this should fundamentally work (if maybe a bit different than expected):
But looking at the MySQL docs, this does not seem to be supported at all:
Similar for MariaDB:
We even mention similar in our engines comments:
https://github.com/prisma/prisma-engines/blob/ccf3dc944acdabb431947150e12b984b34c538cd/query-engine/connector-test-kit-rs/query-engine-tests/tests/new/ref_actions/on_delete/set_default.rs#L1
https://github.com/prisma/prisma-engines/blob/ccf3dc944acdabb431947150e12b984b34c538cd/migration-engine/migration-engine-tests/tests/migrations/relations.rs#L565-L566
We should adapt our validation to not allow this, and update our documentation afterwards as well. No need for our users to waste their time with this.
The text was updated successfully, but these errors were encountered: