Trying to implement the suggestions made to this other question:
I have written this migration to remove the current index and create the new one:
class ChangeIndexes < ActiveRecord::Migration[5.1]
def change
remove_index :part_masters, name: "part_masters_on_combo_idx"
execute <<-SQL
CREATE INDEX ON part_masters (lower(unaccent(combo)) text_pattern_ops);
CREATE INDEX ON locations (lower(unaccent(ubicacion)) text_pattern_ops);
SQL
end
end
The problem is that I'm getting this error, I think because I'm using functions like lower or unaccent to create the index:
PG::InvalidObjectDefinition: ERROR: functions in index expression must be marked IMMUTABLE