SchemaPlus / schema_plus_pg_indexes

Adds support in ActiveRecord for PostgreSQL index expressions and operator classes, as well as a shorthand for case-insensitive indexes
MIT License
30 stars 13 forks source link

Correctly generate configuration when there are multiple columns but only one non-default operator class used #4

Closed nbudin closed 9 years ago

nbudin commented 9 years ago

If you have an index defined such as:

add_index "animals", ["species_id", "adoption_status"], name: "index_animals_on_species_and_status", operator_class: {"adoption_status"=>"text_pattern_ops"}

Then schema_plus_pg_indexes will incorrectly dump the schema as:

add_index "animals", ["species_id", "adoption_status"], name: "index_animals_on_species_and_status", operator_class: "text_pattern_ops"

This patch fixes that issue.

ronen commented 9 years ago

Good catch. Thanks!

Merged and released as v0.1.6