You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is designed to track the 'safe' version of implementing add_reference.
Rails, by default, indexes reference columns. This is usually a good idea (and can be disabled by passing index: false when it isn't). However, it adds indexes in a naive, unsafe way, without using CONCURRENTLY to maintain availability.
To fulfil this ticket, we must:
Re-add add_reference and remove_reference, setting index: false in the output[1]. If index: true is explicitly set, a validation error should explain that this is not allowed. (Add add_reference and remove_reference: version 2.0 #82)
Add a generator for add_reference, that will generate two migrations - one to add the column (or columns, in the case of a polymorphic key) and one to add an index.
Change generator for foreign_key, changing the first migration to use (add|remove)_reference and adding a fourth to create an index on the column. There should be a --no-index class option that disables the index creation.
[1]: Weirdly, Rails seems to ignore the index option in remove_reference, despite using it in one of the examples. This needs to be investigated further.
The text was updated successfully, but these errors were encountered:
This issue is designed to track the 'safe' version of implementing
add_reference
.Rails, by default, indexes reference columns. This is usually a good idea (and can be disabled by passing
index: false
when it isn't). However, it adds indexes in a naive, unsafe way, without usingCONCURRENTLY
to maintain availability.To fulfil this ticket, we must:
add_reference
andremove_reference
, settingindex: false
in the output[1]. Ifindex: true
is explicitly set, a validation error should explain that this is not allowed. (Add add_reference and remove_reference: version 2.0 #82)add_reference
, that will generate two migrations - one to add the column (or columns, in the case of a polymorphic key) and one to add an index.foreign_key
, changing the first migration to use(add|remove)_reference
and adding a fourth to create an index on the column. There should be a--no-index
class option that disables the index creation.[1]: Weirdly, Rails seems to ignore the
index
option inremove_reference
, despite using it in one of the examples. This needs to be investigated further.The text was updated successfully, but these errors were encountered: