2017-06-30 16:23:28 +08:00
|
|
|
class AddCreatedByToAssets < ActiveRecord::Migration[4.2]
|
2016-02-12 23:52:43 +08:00
|
|
|
def change
|
2019-01-07 20:29:17 +08:00
|
|
|
%i(
|
|
|
|
assets checklists checklist_items my_module_groups
|
2019-08-06 00:22:07 +08:00
|
|
|
my_module_tags my_modules teams projects
|
|
|
|
sample_groups sample_types tables tags
|
2019-01-07 20:29:17 +08:00
|
|
|
).each do |table_name|
|
2016-02-12 23:52:43 +08:00
|
|
|
add_column table_name, :created_by_id, :integer
|
|
|
|
add_index table_name, :created_by_id
|
|
|
|
end
|
|
|
|
|
2019-01-07 20:29:17 +08:00
|
|
|
%i(
|
|
|
|
assets checklists checklist_items comments
|
|
|
|
custom_fields my_modules teams projects
|
2019-08-06 00:22:07 +08:00
|
|
|
reports results sample_groups sample_types samples
|
|
|
|
steps tables tags
|
2019-01-07 20:29:17 +08:00
|
|
|
).each do |table_name|
|
2016-02-12 23:52:43 +08:00
|
|
|
add_column table_name, :last_modified_by_id, :integer
|
|
|
|
add_index table_name, :last_modified_by_id
|
|
|
|
end
|
|
|
|
|
2019-01-07 20:29:17 +08:00
|
|
|
%i(my_modules projects results).each do |table_name|
|
2016-02-12 23:52:43 +08:00
|
|
|
add_column table_name, :archived_by_id, :integer
|
|
|
|
add_index table_name, :archived_by_id
|
|
|
|
add_column table_name, :restored_by_id, :integer
|
|
|
|
add_index table_name, :restored_by_id
|
|
|
|
add_column table_name, :restored_on, :datetime
|
|
|
|
end
|
|
|
|
|
2019-08-06 00:22:07 +08:00
|
|
|
%i(sample_my_modules user_my_modules user_teams user_projects).each do |table_name|
|
2016-02-12 23:52:43 +08:00
|
|
|
add_column table_name, :assigned_by_id, :integer
|
|
|
|
add_index table_name, :assigned_by_id
|
|
|
|
end
|
|
|
|
|
|
|
|
add_column :sample_my_modules, :assigned_on, :datetime
|
|
|
|
end
|
|
|
|
end
|