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

Bug: Only creates one index using an expression without a column #8

Closed ronen closed 8 years ago

ronen commented 8 years ago

AR's core implementation of a table definition stores index definitions keyed by column. but expression-only indexes have no column. so with multiple expression only indexes, such as:

  create_table "streams", force: :cascade do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
    t.jsonb    "dependencies",       null: false
    t.index name: "index_first", using: :gin, expression: "(dependencies -> 'one'::text)"
    t.index name: "index_second", using: :gin, expression: "(dependencies -> 'two'::text)"
  end

both the index definitions collide in and the last one wins.

Reported by @fj in SchemaPlus/schema_plus#227

ronen commented 8 years ago

Fixed, released v0.1.9