Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
386 views
in Technique[技术] by (71.8m points)

postgresql - Rails 4 pgsql add_index with type GIN or GiST

In Rails it is possible to do:

add_index :table, :column_name, :using => 'btree'

Is it possible in Rails 4 with PGSQL to add a GIN or GiST index like:

add_index :students, :name, :using => 'gin'

Or do I have use manual execute statements? The notion behind this is I would like to keep schema.rb instead of using structure.sql

question from:https://stackoverflow.com/questions/18725081/rails-4-pgsql-add-index-with-type-gin-or-gist

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In Rails 4, you can now do something like this in a migration:

add_index :products, :data, using: :gin

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...