lomba/schema_plus — pull request #66 by eugenebolshakov (2012-10-09 08:57:50+00:00)
Title: Fixes for postgres index type and expression support

There is currently a problem if you want to use a non-default index type in postgres. If you do

`add_index(:users, :expression => "USING hash (upper(login))", :name => 'users_login_index')`

it will be created fine, but the schema dumper will generate a line with a :kind attribute:

`add_index :users, :kind => 'hash', :expression => 'upper((login)::text)', :name => 'users_login_index'`

and the attribute will be ignored if you try to load the generated schema, the SQL will look something like:

`CREATE INDEX "users_login_index" ON "users" upper((login)::text)`

Also if you just do

`add_index(:users, :expression => 'upper(login)', :name => 'users_login_index')`

it will generate the same SQL, but in this case it just needs to wrap the expression in parentheses (otherwise the query fails).

This PR should fix both issues.