💜Clari
💜Clari
PPrisma
Created by 💜Clari on 7/31/2024 in #help-and-questions
Removing enum value fails on foreign key
I'm getting the below error when i try to remove an enum value from the database
Error: P3006

Migration `20240731215417_drop_rqi_enum_val` failed to apply cleanly to the shadow database.
Error:
db error: ERROR: foreign key constraint "Notification_certificationType_profileId_fkey" cannot be implemented
DETAIL: Key columns "certificationType" and "code" are of incompatible types: "CertificationType" and "CertificationType_new".
0: sql_schema_connector::validate_migrations
with namespaces=None
at schema-engine/connectors/sql-schema-connector/src/lib.rs:312
1: schema_core::state::DevDiagnostic
at schema-engine/core/src/state.rs:270
Error: P3006

Migration `20240731215417_drop_rqi_enum_val` failed to apply cleanly to the shadow database.
Error:
db error: ERROR: foreign key constraint "Notification_certificationType_profileId_fkey" cannot be implemented
DETAIL: Key columns "certificationType" and "code" are of incompatible types: "CertificationType" and "CertificationType_new".
0: sql_schema_connector::validate_migrations
with namespaces=None
at schema-engine/connectors/sql-schema-connector/src/lib.rs:312
1: schema_core::state::DevDiagnostic
at schema-engine/core/src/state.rs:270
5 replies
PPrisma
Created by 💜Clari on 4/23/2024 in #help-and-questions
offset-based pagination in a field with a relation
let item = await prisma.item.findFirstOrThrow({
where: {
id: req.params.id
},
include: {
updates: {
skip: +req.params.page * pageSize || 0,
take: pageSize
}
}
});
let item = await prisma.item.findFirstOrThrow({
where: {
id: req.params.id
},
include: {
updates: {
skip: +req.params.page * pageSize || 0,
take: pageSize
}
}
});
Essentially, I have a schema with updates ItemUpdate[], and I need to fetch its updates, but i want to paginate it. i know i can just do prisma.itemUpdates.fetchMany, but I want to be able to return a 404 when the item ID is not found - and it's possible for the item to exist without any updates - and i can't check that if i'm simply using a where { itemId } in an itemUpdates call so, is this valid? ^^^
1 replies