SchemaPlus / schema_plus

SchemaPlus provides a collection of enhancements and extensions to ActiveRecord
Other
679 stars 84 forks source link

Bug: Postgres expression index with multiple expressions runs correct SQL, but produces incorrect schema modifications #225

Closed fj closed 9 years ago

fj commented 9 years ago

Running this migration

class TestingMigration < ActiveRecord::Migration
  def change
    change_table :foo do |t|
      t.index(
        expression: "bar, (baz->>'wizzle')",
        name: 'idx_test'
      )
    end
  end
end

will run this SQL command

CREATE  INDEX  "idx_test" ON "foo"  (bar, (baz->>'wizzle'))

but will add this incomplete directive to the schema:

 # expression was dropped!
 add_index "foo", ["bar"], name: "idx_test"

The expected result is that we instead get something like

 add_index "foo", ["bar", "(baz->>'wizzle')"], name: "idx_test"

in the schema.

ronen commented 9 years ago

Closed in favor of SchemaPlus/schema_plus_pg_indexes#5

ronen commented 9 years ago

@fj FYI this should now be fixed in schema_plus_pg_indexes v0.1.7