oy, i have two models, Vehicle and Driver. They ar...
# orm-help
j
oy, i have two models, Vehicle and Driver. They are related by a one to one relation, which marks which car is currently occupied by wich driver. the relation is marked as optional on both ends. the problem i now face is that i can't create a vehicle, as i receive the following exception: "Null constraint violation on the fields: (
driverId
)". Do you know how i could approach this error?
r
Could you show us the schema?
j
sure
and
r
driverId
might need to be optional too 🤔
if
driverId
is never null,
driver
can't be either, is what I'm guessing
j
well, that does make sense 🙃. i'll try this out
👍 1
you were right, this made it work. thank you (i'll remove the schema details)
r
no problem! glad I could help 🙂