2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/generators/acts_as_commentable_with_threading_migration/templates/migration.rb', line 2
def self.up
create_table :comments, :force => true do |t|
t.integer :commentable_id, :default => 0
t.string :commentable_type
t.string :title
t.text :body
t.string :subject
t.integer :user_id, :default => 0, :null => false
t.integer :parent_id, :lft, :rgt
t.timestamps
end
add_index :comments, :user_id
add_index :comments, [:commentable_id, :commentable_type]
end
|