Class: CreateReputationsTable

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/social_engine/install/templates/create_reputations_table.rb

Class Method Summary collapse

Class Method Details

.downObject



14
15
16
17
18
# File 'lib/generators/social_engine/install/templates/create_reputations_table.rb', line 14

def self.down
  remove_index :reputations, :reputation_action_id
  remove_index :reputations, :name=> :user_reputation
  drop_table :reputations
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/generators/social_engine/install/templates/create_reputations_table.rb', line 2

def self.up
  create_table :reputations, :force => true do |t|
    t.integer :user_id
    t.integer :reputation_action_id
    t.integer :value
    t.timestamps
  end
  
  add_index :reputations, [:user_id,:reputation_action_id], :name => "user_reputation", :unique => false
  add_index :reputations, :reputation_action_id
end