Sha256: 713f159516dc0dd7f80867360f398951281e52dc4f398096d096783acaafdf4d

Contents?: true

Size: 821 Bytes

Versions: 20

Compression:

Stored size: 821 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
      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

20 entries across 10 versions & 1 rubygems

Version Path
acts-as-approvable-0.6.7 lib/generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.7 generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.6 lib/generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.6 generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.5 generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.5 lib/generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.4 lib/generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.4 generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.3.3 generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.3.3 lib/generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.3.2 lib/generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.3.2 generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.3.1 generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.3.1 lib/generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.3 lib/generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.3 generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.2 lib/generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.2 generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.1 lib/generators/acts_as_approvable/templates/create_approvals.rb
acts-as-approvable-0.6.1 generators/acts_as_approvable/templates/create_approvals.rb