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

Using references wrong does not generate error #423

Open
jeroen11dijk opened this issue Nov 13, 2024 · 0 comments
Open

Using references wrong does not generate error #423

jeroen11dijk opened this issue Nov 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jeroen11dijk
Copy link

Describe the bug
I had a matching table resource with a has_many to timeslots, and wanted to delete those if the matching table got remove. So I added the following to matching table:

references do
  reference :timeslots, on_delete: :delete
end

Turns out you need to do it on the belongs_to but this didnt give any warnings when generating migrations just that there werent any changes. I dont know if its possible to add a warning but would imo be a nice change

To Reproduce
Create two resources, one with a has_many and the other with a belongs_to. Then add a delete reference to the one with the has_many relationship and try to generate migrations.

Expected behavior
I would expect either an error or warning saying that this reference is useless and a suggestion to put it on the belongs_to resource.

** Runtime
[ - Elixir version](elixir: "> 1.16",)
{:ash, "
> 3.4.37"},
{:ash_postgres, "> 2.4.12"},
{:ash_phoenix, "
> 2.0"},
{:ash_admin, "> 0.11.9"},
{:ash_authentication, "
> 4.2.7"},
{:ash_authentication_phoenix, "~> 2.1.2"},

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
Status: Someday
Development

No branches or pull requests

2 participants