Skip to content

Add {:nilify, columns} to on_delete reference option. #474

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

Merged

Conversation

greg-rychlewski
Copy link
Member

Postgres 15 allows the user to specify which columns should be set to null if the referenced record is deleted.

A side note: I noticed that one of the common on delete options from postgres/mysql is not present: ON DELETE SET DEFAULT. I was wondering if this was on purpose or I can submit a PR to add it? I wasn't sure if it was left out on purpose to avoid having to do the same thing for associations.

@greg-rychlewski greg-rychlewski changed the title Add {:nilify, column_list} to on_delete reference option. Add {:nilify, columns} to on_delete reference option. Feb 5, 2023
Copy link
Member

@v0idpwn v0idpwn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, just a small comment

@josevalim
Copy link
Member

A side note: I noticed that one of the common on delete options from postgres/mysql is not present: ON DELETE SET DEFAULT.

Sounds good to support it. At the same time nobody asked for it, so we are probably fine. :) Especially as nilifying likely covers the exact same cases.

@greg-rychlewski
Copy link
Member Author

Sounds good to support it. At the same time nobody asked for it, so we are probably fine. :) Especially as nilifying likely covers the exact same cases.

Sorry I should have put it in description, this person here asked for ON DELETE SET NULL columns and ON DELETE SET DEFAULT columns:

https://groups.google.com/g/elixir-ecto/c/IIbzAgZYgXw

@greg-rychlewski greg-rychlewski merged commit 89bf043 into elixir-ecto:master Feb 5, 2023
@greg-rychlewski greg-rychlewski deleted the on_delete_column_list branch February 7, 2023 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants