Sha256: abf9277dc44241f566e218ae1fdeddeecd4e755f78f5b95adb02456c64d2d189

Contents?: true

Size: 884 Bytes

Versions: 8

Compression:

Stored size: 884 Bytes

Contents

class CreateApprovals < ActiveRecord::Migration
  def self.up
    create_table :approvals do |t|
      t.string  :item_type, :null => false
      t.integer :item_id,   :null => false
      t.string  :event,     :null => false
      t.integer :state,     :null => false, :default => 0
<% if options[:owner] %>      t.integer :owner_id
<% end %>      t.text    :object,    :limit => 16777216
      t.text    :original,  :limit => 16777216
      t.text    :reason

      t.timestamps
    end

    add_index :approvals, [:state, :event]
    add_index :approvals, [:item_type, :item_id]
<% if options[:owner] %>    add_index :approvals, [:owner_id]
<% end %>  end

  def self.down
    remove_index :approvals, [:state, :event]
    remove_index :approvals, [:item_type, :item_id]
<% if options[:owner] %>    remove_index :approvals, [:owner_id]
<% end %>    drop_table :approvals
  end
end

Version data entries

8 entries across 4 versions & 2 rubygems

Version Path
acts_as_approvable-0.7.0 generators/acts_as_approvable/templates/create_approvals.rb
acts_as_approvable-0.7.0 lib/generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.9.1 lib/generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.9.1 generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.9 generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.9 lib/generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.8.1 generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.8.1 lib/generators/acts_as_approvable/templates/create_approvals.rb