Files
grecia/db/migrate/20150718091702_acts_as_commentable_with_threading_migration.rb
Julian Herrero 65c30c8d2d Remove migrations warning
DEPRECATION WARNING: Directly inheriting from ActiveRecord::Migration
is deprecated. Please specify the Rails release the migration was
written for:

class MigrationClass < ActiveRecord::Migration[4.2]

(called from require at bin/rails:4)
2019-04-17 17:40:56 +02:00

22 lines
527 B
Ruby

class ActsAsCommentableWithThreadingMigration < ActiveRecord::Migration[4.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.timestamps
end
add_index :comments, :user_id
add_index :comments, [:commentable_id, :commentable_type]
end
def self.down
drop_table :comments
end
end