Class: ActsAsCommentableWithThreadingMigration
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- ActsAsCommentableWithThreadingMigration
- Defined in:
- lib/generators/acts_as_commentable_with_threading_migration/templates/migration.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
18 19 20 |
# File 'lib/generators/acts_as_commentable_with_threading_migration/templates/migration.rb', line 18 def self.down drop_table :comments end |
.up ⇒ Object
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 t.string :commentable_type t.string :title t.text :body t.string :subject t.integer :user_id, :null => false t.integer :parent_id, :lft, :rgt t. end add_index :comments, :user_id add_index :comments, [:commentable_id, :commentable_type] end |