]> git.openstreetmap.org Git - rails.git/blobdiff - lib/migrate.rb
Fix up case statement syntax for ruby 1.9 compatibility
[rails.git] / lib / migrate.rb
index 81cdd4d0541bc485f362c87f4b40b995466b21f6..b3cffd870fe25fe9ddf7d4aa0924dd52d1b1f5d9 100644 (file)
@@ -198,7 +198,13 @@ module ActiveRecord
         else
           index_type = options
         end
-        quoted_column_names = column_names.map { |e| quote_column_name(e) }.join(", ")
+
+        quoted_column_names = column_names.map { |e| quote_column_name(e) }
+        if Hash === options and options[:lowercase]
+          quoted_column_names = quoted_column_names.map { |e| "LOWER(#{e})" }
+        end
+        quoted_column_names = quoted_column_names.join(", ")
+
         execute "CREATE #{index_type} INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} USING #{index_method} (#{quoted_column_names})"
       end
     end