-
Notifications
You must be signed in to change notification settings - Fork 23
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
Definition of unsafe_add_column
is unused
#22
Comments
unsafe_add_column
and unsafe_make_column_not_nullable
are unusedunsafe_add_column
is unused
Actually, it isn't 😞 |
Is there a reason why the lock acquisition shouldn't happen here instead of inside the I'm probably missing something obvious... |
From what I understand, the idea is that even if it is impossible to say that the column-add operation itself is safe from an availability point of view, it is still safer to use the lock acquisition loop than not to do so, so Cf. the readme:
|
Huh, I'd forgotten about that part of the README. The question in my mind is "Why is That being said, it might well be the case that all of the unsafe variants (where it's relevant) should use the safe lock acquisition. I think that's mostly a project policy discussion, since it means the unsafe variants are increasingly not just proxies for the original Rails method (though we've already gone down that path somewhat with the dependent object checks). I think I kinda like continuing down that path. But it will likely end up breaking more compatibility with existing projects. For example, I assume this means locking happens if you use I'm curious what your thoughts are on all of that. |
See also #34 add_column on PostgreSQL > 11 generally shouldn't require this lock; and maybe not even unsafe nomenclature. |
I closed #23 since it's been open for so long, but we think that would make a great starting point. |
While trying to test some lock scenarios, I spotted this little problem.
Basically, unlike all the other
unsafe_
methods, this one - along withunsafe_make_column_not_nullable
- is supposed to have a custom implementation that uses the lock acquisition logic rather than delegating directly toActiveRecord::Migration
. However, the custom implementation are further away in the inheritance chain, so it never gets called - the delegate inunsafe_statements
gets called instead.I thought initially that this was a bug I'd introduced, but I've reproduced it on 1.0.0 as well.
Fix should be as simple as removing the delegate from
unsafe_statements
...EDIT: only
unsafe_add_column
is affected, notunsafe_make_column_not_nullable
as I initially thought.The text was updated successfully, but these errors were encountered: