Skip to content

Using references wrong does not generate error #423

Open
@jeroen11dijk

Description

@jeroen11dijk

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"},

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Someday

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions