lomba/schema_plus — pull request #112 by tovodeverett (2013-07-26 04:19:13+00:00)
Title: Fix schema dump for case insensitive indexes with ids and strings

* `SchemaPlus::ActiveRecord::ConnectionAdapters::PostgresqlAdapter#indexes`
had issues with case insensitive indexes that mixed id columns and
strings - it didn't dump the id columns.
* I added a test to `spec/schema_dumper_spec.rb` to test a particularly
malicious index that interleaves id columns with non-id columns. In
order to get the index name under 63 characters, I added two columns
with short names to the `Post` table (`str_short` and `short_id`).
* I modified `PostgresqlAdapter#indexes` to have a more robust regex for
testing expression. It then extracts a list of case insensitive
columns and then uses `index_keys` to generate the list of column
names, extracting the true columns from `columns` and the case
insensitive expressions from `case_insensitive_columns`.
* It did not escape my notice that there may be issues defining
case insensitive indexes that mix non-id numeric or binary columns
with string/text columns, but I chose not to worry about that at
this time.

Also note that in order to test I modified `schema_plus.gemspec` to specify `"rails", "~> 3.2.14"` and added `gem 'pg'` to `Gemfile`, but did not include these in the commit.