Cascading delete and pub_sub
Hi @everyone,
I have a resource (Notification)
```elixir
defmodule App.Notifications.Notification do
use Ash.Resource,
....
postgres do
table "notifications"
repo CauseBeacon.Repo
references do
....
reference :message, on_delete: :delete, index?: false
....
end
end
pub_sub do
module CauseBeaconWeb.Endpoint
prefix "notifications"
transform fn pub_sub_notification ->
Map.take(pub_sub_notification.data, [:id, :user_id, :message_id, :activity_id])
end
publish :create, ["created", :user_id]
publish :mark_as_read, ["updated", :user_id, :id]
publish :mark_as_unread, ["updated", :user_id, :id]
publish :destroy, ["destroyed", :user_id, :id]
end
relationships do
...
belongs_to :message, CauseBeacon.Notifications.Message,
allow_nil?: true,
public?: true
end
...
end
When I delete a Message, it also deletes the Notification. BUT it seems to not generate the pub_sube notification. Did I forget something specific in my code ?
Regards,
Angy.
I have a resource (Notification)
```elixir
defmodule App.Notifications.Notification do
use Ash.Resource,
....
postgres do
table "notifications"
repo CauseBeacon.Repo
references do
....
reference :message, on_delete: :delete, index?: false
....
end
end
pub_sub do
module CauseBeaconWeb.Endpoint
prefix "notifications"
transform fn pub_sub_notification ->
Map.take(pub_sub_notification.data, [:id, :user_id, :message_id, :activity_id])
end
publish :create, ["created", :user_id]
publish :mark_as_read, ["updated", :user_id, :id]
publish :mark_as_unread, ["updated", :user_id, :id]
publish :destroy, ["destroyed", :user_id, :id]
end
relationships do
...
belongs_to :message, CauseBeacon.Notifications.Message,
allow_nil?: true,
public?: true
end
...
end
When I delete a Message, it also deletes the Notification. BUT it seems to not generate the pub_sube notification. Did I forget something specific in my code ?
Regards,
Angy.
