Hello, is there any way to subscribe to changes of...
# prisma-whats-new
d
Hello, is there any way to subscribe to changes of relations? I have a 1:n relation and would like to listen to its changes but couldn’t find a way to do this
j
@dohomi Subscriptions currently do not react to relations - the way to solve this is to create a dummy attribute on the model and update that, e.g. if you have a relation between
Groups
and
Items
, whenever
Item
moves to a different group you can also
touch
the
Group
to trigger the Subscription
d
ok that is unfortunate, I thought some better option is available. Does it mean that updatedAt is also not updated of the schema when changing the relation?
@jan Ok thanks. I thought I could update
updatedAt
directly but it seems to be protected. I am using now a separate update field on all my relation changes and this works. Thanks again
j
Yes, that is what I’m doing as well