• E
    Add `if_exists` option to `remove_index` · 36ea1084
    eileencodes 提交于
    This PR allows for passing `if_exists` options to the `remove_index`
    method so that we can ignore already removed indexes. This work follows
    column `if/if_not_exists` from #38352 and `:if_not_exists` on `add_index`
    from #38555.
    
    We've found this useful at GitHub, there are migrations where we don't
    want to raise if an index was already removed. This will allow us to
    remove a monkey patch on `remove_index`.
    
    I considered raising after the `index_name_for_remove` method is called
    but that method will raise if the index doesn't exist before we get to
    execute. I have a commit that refactors this but after much
    consideration this change is cleaner and more straightforward than other
    ways of implementing this.
    
    This change also adds a little extra validation to the `add_index` test.
    Fix `nodoc` on edited methods.
    36ea1084
schema_statements.rb 31.3 KB