2020-08-07 01:14:14 +02:00
|
|
|
class CreateComments < ActiveRecord::Migration[4.2]
|
2009-01-06 11:49:19 +01:00
|
|
|
def self.up
|
2023-05-12 13:01:12 +02:00
|
|
|
create_table :comments, force: true do |t|
|
|
|
|
t.column :title, :string, limit: 50, default: ''
|
|
|
|
t.column :comment, :string, default: ''
|
|
|
|
t.column :created_at, :datetime, null: false
|
|
|
|
t.column :commentable_id, :integer, default: 0, null: false
|
|
|
|
t.column :commentable_type, :string, limit: 15,
|
|
|
|
default: '', null: false
|
|
|
|
t.column :user_id, :integer, default: 0, null: false
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
2021-03-01 15:27:26 +01:00
|
|
|
|
2023-05-12 13:01:12 +02:00
|
|
|
add_index :comments, ['user_id'], name: 'fk_comments_user'
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
2021-03-01 15:27:26 +01:00
|
|
|
|
2009-01-06 11:49:19 +01:00
|
|
|
def self.down
|
|
|
|
drop_table :comments
|
|
|
|
end
|
|
|
|
end
|