Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cascade destroy on has_many does not work correctly if the relationship has a parent filter #461

Closed
barnabasJ opened this issue Jan 14, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@barnabasJ
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is. If you are not sure if the bug is related to ash or an extension, log it with ash and we will move it.

The query that is built to get the related record includes a select for the original record which is not in the db anymore because the destroy is executed in an after action

To Reproduce
A minimal set of resource definitions and calls that can reproduce the bug.

Expected behavior
A clear and concise description of what you expected to happen.

** Runtime

  • Elixir version 1.18
  • Erlang version 27
  • OS Ubuntu
  • Ash version 3.4.55
  • AshPostgres main
  • any related extension versions

Additional context
Add any other context about the problem here.

@barnabasJ barnabasJ added bug Something isn't working needs review labels Jan 14, 2025
@zachdaniel
Copy link
Contributor

Ah, interesting. We need to do it in a before hook if it's a destroy action then.

@zachdaniel
Copy link
Contributor

I won't have time to get to this in the near future unfortunately.

@barnabasJ
Copy link
Contributor Author

I can probably take a look sometime this week. I fixed my problem with some custom SQL at the moment to get unblocked. And I need to do some other things first.

@barnabasJ
Copy link
Contributor Author

Still planning on doing this, just didn't find any time on the weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

2 participants