Class: AlterTaggableIdToString

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/blacklight_user_generated_content/templates/alter_taggable_id_to_string.rb

Class Method Summary collapse

Class Method Details

.downObject



8
9
10
11
12
# File 'lib/generators/blacklight_user_generated_content/templates/alter_taggable_id_to_string.rb', line 8

def self.down
  remove_index :taggings, [:taggable_id, :taggable_type, :context]
  change_column :taggings, :taggable_id, :integer
  add_index :taggings, [:taggable_id, :taggable_type, :context]
end

.upObject



2
3
4
5
6
# File 'lib/generators/blacklight_user_generated_content/templates/alter_taggable_id_to_string.rb', line 2

def self.up
  remove_index :taggings, [:taggable_id, :taggable_type, :context]
  change_column :taggings, :taggable_id, :string
  add_index :taggings, [:taggable_id, :taggable_type, :context]
end