Class: CreateHoundActions

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

Class Method Summary collapse

Class Method Details

.downObject



16
17
18
19
20
# File 'lib/generators/hound/templates/create_hound_actions.rb', line 16

def self.down
  remove_index :hound_actions, [:actionable_type, :actionable_id]
  remove_index :hound_actions, [:user_type, :user_id]
  drop_table :hound_actions
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/hound/templates/create_hound_actions.rb', line 2

def self.up
  create_table :hound_actions do |t|
    t.string   :action,          null: false
    t.string   :actionable_type, null: false
    t.integer  :actionable_id,   null: false
    t.integer  :user_id
    t.string   :user_type
    t.datetime :created_at
    t.text     :changeset
  end
  add_index :hound_actions, [:actionable_type, :actionable_id]
  add_index :hound_actions, [:user_type, :user_id]
end