Class: CreateCommentsTable

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

Class Method Summary collapse

Class Method Details

.downObject



19
20
21
22
# File 'lib/generators/social_engine/install/templates/create_comments_table.rb', line 19

def self.down
  remove_index :comments, :name=> :comments_index
  drop_table :comments
end

.upObject



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

def self.up
  create_table :comments, :force => true do |t|
    t.string :commentable_type
    t.integer :commentable_id
    t.integer :user_id
    t.text :comment
    t.string :unauthenticated_name
    t.string :unauthenticated_email
    t.string :unauthenticated_website
    t.string :ip_address
    t.string :session_hash
    t.string :browser_fingerprint      
    t.timestamps
  end    
  add_index :comments, [:commentable_type, :commentable_id, :ip_address, :browser_fingerprint], :name => "comments_index", :unique => false
end