-
Notifications
You must be signed in to change notification settings - Fork 313
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
Add Ecto.Migration.remove_if_exists/1
#624
Add Ecto.Migration.remove_if_exists/1
#624
Conversation
@@ -39,7 +39,8 @@ defmodule Ecto.Adapter.Migration do | |||
| {:remove, field :: atom, type :: Ecto.Type.t() | Reference.t() | binary(), | |||
Keyword.t()} | |||
| {:remove, field :: atom} | |||
| {:remove_if_exists, type :: Ecto.Type.t() | Reference.t() | binary()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spec was missing field
Sorry, I may be missing something, but shouldn't we promote |
unlike personally, i often reach for since the second argument doesn't matter for any use-case for psql users and lots of use-cases for mysql folks, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
This creates a
...if_exists
mirror forremove/1
. I'm guessingremove_if_exists/2
is needed for mysql, but psql will drop fkey constraints as part of dropping the column, soremove_if_exists/2
is unnecessary in that case.I also updated the documentation for
remove_if_exists/2
to help make it clearer why the type can/should be passed