Sha256: 62cb1f84d5c7b227386a6808bf6e254d3680c2d515d47bb1e9f2f0a97f3cdc37
Contents?: true
Size: 917 Bytes
Versions: 23
Compression:
Stored size: 917 Bytes
Contents
class ChangeSearchAttributeToMethod < ActiveRecord::Migration class Search < ActiveRecord::Base include Discerner::Methods::Models::Parameter end def self.up add_column :discerner_parameters, :search_method, :string Discerner::Parameter.order(:id).each do |p| p.search_method = p.search_attribute p.save! end remove_index :discerner_parameters, :name => 'index_discerner_parameters' remove_column :discerner_parameters, :search_attribute end def self.down add_column :discerner_parameters, :search_attribute, :string Discerner::Parameter.order(:id).each do |p| p.search_attribute = p.search_method p.save! end remove_column :discerner_parameters, :search_method add_index :discerner_parameters, [:search_model, :search_attribute, :parameter_category_id, :deleted_at], :unique => true, :name => 'index_discerner_parameters' end end
Version data entries
23 entries across 23 versions & 1 rubygems