Class: CreateMakeFlaggableTables
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateMakeFlaggableTables
- Defined in:
- lib/generators/make_flaggable/templates/migration.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
17 18 19 20 21 22 |
# File 'lib/generators/make_flaggable/templates/migration.rb', line 17 def self.down remove_index :flaggings, :column => [:flaggable_type, :flaggable_id] remove_index :flaggings, :name => "access_flaggings" drop_table :flaggings end |
.up ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/generators/make_flaggable/templates/migration.rb', line 2 def self.up create_table :flaggings do |t| t.string :flaggable_type t.integer :flaggable_id t.string :flagger_type t.integer :flagger_id t.text :reason t. end add_index :flaggings, [:flaggable_type, :flaggable_id] add_index :flaggings, [:flagger_type, :flagger_id, :flaggable_type, :flaggable_id], :name => "access_flaggings" end |