2014-08-06 14:47:47 +02:00
|
|
|
# Add comments for administrators to internally share about any item
|
2013-11-14 17:07:48 +01:00
|
|
|
class CreateActiveAdminComments < ActiveRecord::Migration
|
2014-08-15 19:28:51 +02:00
|
|
|
# rubocop:disable Metrics/MethodLength
|
2013-11-14 17:07:48 +01:00
|
|
|
def self.up
|
|
|
|
create_table :active_admin_comments do |t|
|
|
|
|
t.string :namespace
|
2014-08-06 14:47:47 +02:00
|
|
|
t.text :body
|
|
|
|
t.string :resource_id, null: false
|
|
|
|
t.string :resource_type, null: false
|
|
|
|
t.references :author, polymorphic: true
|
2013-11-14 17:07:48 +01:00
|
|
|
t.timestamps
|
|
|
|
end
|
2017-04-22 20:01:47 +02:00
|
|
|
add_index :active_admin_comments, %i[namespace]
|
|
|
|
add_index :active_admin_comments, %i[author_type author_id]
|
|
|
|
add_index :active_admin_comments, %i[resource_type resource_id]
|
2013-11-14 17:07:48 +01:00
|
|
|
end
|
2018-01-01 17:52:33 +01:00
|
|
|
# rubocop:enable Metrics/MethodLength
|
2013-11-14 17:07:48 +01:00
|
|
|
|
|
|
|
def self.down
|
|
|
|
drop_table :active_admin_comments
|
|
|
|
end
|
|
|
|
end
|