Sha256: f7081e07c3fd3969ad5d96deb08eb71352d4f81d84e91429e1d90e723c801572

Contents?: true

Size: 652 Bytes

Versions: 2

Compression:

Stored size: 652 Bytes

Contents

class CreateMakeFlaggableTables < ActiveRecord::Migration
   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.timestamps
    end

    add_index :flaggings, [:flaggable_type, :flaggable_id]
    add_index :flaggings, [:flagger_type, :flagger_id, :flaggable_type, :flaggable_id], :name => "access_flaggings"
  end

  def self.down
    remove_index :flaggings, :column => [:flaggable_type, :flaggable_id]
    remove_index :flaggings, :name => "access_flaggings"
    
    drop_table :flaggings
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
make_flaggable-0.0.3 lib/generators/make_flaggable/templates/migration.rb
make_flaggable-0.0.2 lib/generators/make_flaggable/templates/migration.rb