Having the current database table setup (User &amp...
# orm-help
p
Having the current database table setup (User & Post) tables with a one-to-many relation on the User->Post I can't get the cascade delete to work, because of a relation conflict. What would be the way to go about this? (SQLITE) Error: "PrismaClientKnownRequestError2 [PrismaClientKnownRequestError]: The change you are trying to make would violate the required relation 'PostToUser' between the
Post
and
User
models."
r
Cascade deletes do not work if the foreign key is non nullable In this case, I would suggest removing the
not null
on the
userId
or deleting all the posts first then the user.
p
oh boy how'd I miss that. thanks a lot for pointing out the obvious 👍 That did the trick, thanks a bunch.