Class: CreateFavoritesTable

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

Class Method Summary collapse

Class Method Details

.downObject



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

def self.down
  remove_index :favorites, :name=> :favorites_index
  drop_table :favorites
end

.upObject



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

def self.up
  create_table :favorites, :force => true do |t|
    t.string :favoriteable_type
    t.integer :favoriteable_id
    t.integer :user_id
    t.string :ip_address
    t.string :session_hash
    t.string :browser_fingerprint
    t.timestamps
  end
  add_index :favorites, [:favoriteable_type, :favoriteable_id, :ip_address, :browser_fingerprint], :name => "favorites_index", :unique => false
end