Class: CreateFriendingsTable

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

Class Method Summary collapse

Class Method Details

.downObject



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

def self.down
  remove_index :friendings, :friendor_id
  remove_index :friendings, :friendee_id
  drop_table :friendings
end

.upObject



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

def self.up
  create_table :friendings, :force => true do |t|
    t.integer :friendor_id
    t.integer :friendee_id
    t.boolean :confirmed, :default => false
    t.boolean :rejected, :default => false
    t.timestamps
  end
  
  add_index :friendings, :friendor_id
  add_index :friendings, :friendee_id
end