You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
The id field inherited from the parent model cannot be explicitly set when the enhanced create method is called on a "concrete" model. In my project, I have a model Activity, which declares the field id String @id @db.Uuid @default(uuid()), alongside some other shared fields. This model is then extended into a number of other models (i.e. VideoActivity). When calling the enhanced create action against one of the child models, if the id field is specified as part of the create, the action fails with error Unknown argument 'id'.
This bug can be worked around by not specifying the id field in the create call, and instead relying on the @default characteristic to generate a uuid for the entity, however this is not desirable in all cases.
Expected Behaviour
Inlcuding a valid UUID in the create request should insert a row into the database with the provided UUID, overriding the default value.
Screenshots
Minimal code snippets to reproduce the bug:
schema.zmodel
enum ActivityType {
TaskActivity
}
model Activity {
id String @id @db.Uuid @default(uuid())
title String
type ActivityType
@@delegate(type)
@@allow('all', true)
}
model TaskActivity extends Activity {
description String
@@map("task_activity")
@@allow('all', true)
}
Description
The
id
field inherited from the parent model cannot be explicitly set when the enhancedcreate
method is called on a "concrete" model. In my project, I have a modelActivity
, which declares the fieldid String @id @db.Uuid @default(uuid())
, alongside some other shared fields. This model is then extended into a number of other models (i.e. VideoActivity). When calling the enhancedcreate
action against one of the child models, if theid
field is specified as part of the create, the action fails with errorUnknown argument 'id'
.This bug can be worked around by not specifying the id field in the create call, and instead relying on the
@default
characteristic to generate a uuid for the entity, however this is not desirable in all cases.Expected Behaviour
Inlcuding a valid UUID in the
create
request should insert a row into the database with the provided UUID, overriding the default value.Screenshots
Minimal code snippets to reproduce the bug:
schema.zmodel
seed.ts
Environment:
The text was updated successfully, but these errors were encountered: