I'm attempting to upgrade Prisma from 1 to 2, opting to run prisma1 (1.34.12) along-side Prisma2 (3.4.1)
My problem is that after upgrading the MySQL DB and schema, my prisma1 queries are failing when trying to create nested creates in relation tables.
Example (paraphrased) Prisma2 schema:
model User {
id String @id @default(cuid()) @db.Char(30)
email String @db.MediumText
admin Admin?
}
model Admin {
id String @id @default(cuid()) @db.Char(30)
name String @db.MediumText
userId String @db.Char(30)
user User @relation(fields: [userId], references: [id], onUpdate: Restrict)
}
(conn=3216) Field 'userId' doesn't have a default value
This section of the schema-incompatibilities prisma-upgrade doc seems to indicate that, after updating the schema and MySQL DB via the directions in the work-around, prisma1 should stick the userId into that Admin table based on the foreign key constraint, shouldn't it?
Should the documentation indicate that 1-N and 1-1 relations will be broken in Prisma1 queries after upgrading to include Prisma2 support, or maybe they are not broken in Prisma1 and I have just set up my schema or MySQL DB incorrectly?
I'm attempting to upgrade Prisma from 1 to 2, opting to run prisma1 (1.34.12) along-side Prisma2 (3.4.1)
My problem is that after upgrading the MySQL DB and schema, my prisma1 queries are failing when trying to create nested creates in relation tables.
Example (paraphrased) Prisma2 schema:
Example (paraphrased) Prisma1 query:
The (paraphrased) error I get:
This section of the schema-incompatibilities prisma-upgrade doc seems to indicate that, after updating the schema and MySQL DB via the directions in the work-around, prisma1 should stick the userId into that Admin table based on the foreign key constraint, shouldn't it?
https://www.prisma.io/docs/guides/upgrade-guides/upgrade-from-prisma-1/schema-incompatibilities-postgres#all-non-inline-relations-are-recognized-as-m-n
Should the documentation indicate that 1-N and 1-1 relations will be broken in Prisma1 queries after upgrading to include Prisma2 support, or maybe they are not broken in Prisma1 and I have just set up my schema or MySQL DB incorrectly?
Thank you!