I need to create a case-insensitive index on a column in rails. I did this via SQL:
execute(
\"CREATE UNIQUE INDEX index_users_on_lower_email_index
O
Have you considered using schema_plus (https://github.com/lomba/schema_plus)? Among other things (support for enforcing foreign keys in the database and for views), it supports setting case-insensitive indexes for PostgreSQL databases and handles dumping them in the schema. From the Readme, "If you’re using Postgresql, SchemaPlus provides support for conditions, expressions, index methods, and case-insensitive indexes."