aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/schema_dumper.rb
diff options
context:
space:
mode:
authorGreg Navis <contact@gregnavis.com>2017-05-13 03:09:58 +0200
committerGreg Navis <contact@gregnavis.com>2017-11-30 10:46:38 +0100
commit1dca75c2c8f930b58d86cd2216af5e14307b3e53 (patch)
tree2c124dd35e87e3fc27448751e9d4001dd7e90fa5 /activerecord/lib/active_record/schema_dumper.rb
parent1bee2fb600c07625b830afd33b43ead3364c9715 (diff)
downloadrails-1dca75c2c8f930b58d86cd2216af5e14307b3e53.tar.gz
rails-1dca75c2c8f930b58d86cd2216af5e14307b3e53.tar.bz2
rails-1dca75c2c8f930b58d86cd2216af5e14307b3e53.zip
Add support for PostgreSQL operator classes to add_index
Add support for specifying non-default operator classes in PostgreSQL indexes. An example CREATE INDEX query that becomes possible is: CREATE INDEX users_name ON users USING gist (name gist_trgm_ops); Previously it was possible to specify the `gist` index but not the custom operator class. The `add_index` call for the above query is: add_index :users, :name, using: :gist, opclasses: {name: :gist_trgm_ops}
Diffstat (limited to 'activerecord/lib/active_record/schema_dumper.rb')
-rw-r--r--activerecord/lib/active_record/schema_dumper.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb
index 66f7d29886..8cb2851557 100644
--- a/activerecord/lib/active_record/schema_dumper.rb
+++ b/activerecord/lib/active_record/schema_dumper.rb
@@ -189,6 +189,7 @@ HEADER
index_parts << "where: #{index.where.inspect}" if index.where
index_parts << "using: #{index.using.inspect}" if !@connection.default_index_type?(index)
index_parts << "type: #{index.type.inspect}" if index.type
+ index_parts << "opclass: #{index.opclass.inspect}" if index.opclass.present?
index_parts << "comment: #{index.comment.inspect}" if index.comment
index_parts
end