Deleting intermediary table record in a many_to_many relationship
In this example (https://hexdocs.pm/ash/2.6.18/managing-relationships.html) that Post and Tag have a many_to_many relationshp through PostTag, how do I make it so that the deletion of Post also deletes the record in PostTag , but not Tag?
In post.ex, I have this action
which issues this error.
I tried adding manage_relationship with various type options to this but couldn't get it to do what I want.
4 Replies
You want the
references
section in ash_postgres
Found 4 DSL results in ash_postgres for query "references":
* reference: https://ash-hq.org/docs/dsl/ash-resource#postgres-references-reference
* references: https://ash-hq.org/docs/dsl/ash-resource#postgres-references
* ignore?: https://ash-hq.org/docs/dsl/ash-resource#postgres-references-reference-ignore-
* on_update: https://ash-hq.org/docs/dsl/ash-resource#postgres-references-reference-on_update
You can configure the deletion behavior at the database level.
Got it. Thank you!