module ActiveRecord::ConnectionAdapters::SchemaStatements
Public Instance Methods
add_hstore_index(table_name, column_name, options = {})
click to toggle source
Adds a GiST or GIN index to a table which has an hstore column.
Example:
add_hstore_index :people, :info, :type => :gin
Options:
:type = :gist (default) or :gin
See www.postgresql.org/docs/9.2/static/textsearch-indexes.html for more information.
# File lib/activerecord-postgres-hstore/activerecord.rb, line 134 def add_hstore_index(table_name, column_name, options = {}) index_name, index_type, index_columns = add_index_options(table_name, column_name, options) index_type = index_type.present? ? index_type : 'gist' execute "CREATE INDEX #{index_name} ON #{table_name} USING #{index_type}(#{column_name})" end
install_hstore()
click to toggle source
Installs hstore by creating the Postgres extension if it does not exist
# File lib/activerecord-postgres-hstore/activerecord.rb, line 114 def install_hstore execute "CREATE EXTENSION IF NOT EXISTS hstore" end
remove_hstore_index(table_name, options = {})
click to toggle source
Removes a GiST or GIN index of a table which has an hstore column.
Example:
remove_hstore_index :people, :info
# File lib/activerecord-postgres-hstore/activerecord.rb, line 145 def remove_hstore_index(table_name, options = {}) index_name = index_name_for_remove(table_name, options) execute "DROP INDEX #{index_name}" end
uninstall_hstore()
click to toggle source
Uninstalls hstore by dropping Postgres extension if it exists
# File lib/activerecord-postgres-hstore/activerecord.rb, line 120 def uninstall_hstore execute "DROP EXTENSION IF EXISTS hstore" end