aboutsummaryrefslogtreecommitdiffstats
path: root/db/migrate
diff options
context:
space:
mode:
authorZog2018-03-07 07:50:02 +0100
committerZog2018-03-12 12:00:13 +0100
commitb810deb08cadd56caeb76eb81cff363458bb79a3 (patch)
tree6fd0c1bc383a9fa501666f6d86cee2ec06c573cd /db/migrate
parent7b53b4c86d0469c21b54f4f974fbae5fc205ed0f (diff)
downloadchouette-core-b810deb08cadd56caeb76eb81cff363458bb79a3.tar.bz2
Refs #6133; Fix specs
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20171106111448_update_import_message_criticity_type_to_string.rb4
-rw-r--r--db/migrate/20180306152953_update_imports_names.rb8
2 files changed, 10 insertions, 2 deletions
diff --git a/db/migrate/20171106111448_update_import_message_criticity_type_to_string.rb b/db/migrate/20171106111448_update_import_message_criticity_type_to_string.rb
index c14450387..a08a10b9a 100644
--- a/db/migrate/20171106111448_update_import_message_criticity_type_to_string.rb
+++ b/db/migrate/20171106111448_update_import_message_criticity_type_to_string.rb
@@ -7,10 +7,10 @@ class UpdateImportMessageCriticityTypeToString < ActiveRecord::Migration
when 0 then "info"
when 1 then "warning"
when 2 then "error"
- else
+ else
"info"
end
end
- ImportMessage.all.each { |im| im.update_attribute(:criticity, change_criticity_value(im.criticity)) }
+ Import::Message.all.each { |im| im.update_attribute(:criticity, change_criticity_value(im.criticity)) }
end
end
diff --git a/db/migrate/20180306152953_update_imports_names.rb b/db/migrate/20180306152953_update_imports_names.rb
new file mode 100644
index 000000000..086d5ce5a
--- /dev/null
+++ b/db/migrate/20180306152953_update_imports_names.rb
@@ -0,0 +1,8 @@
+class UpdateImportsNames < ActiveRecord::Migration
+ def change
+ Import::Base.all.pluck(:type).uniq.each do |type|
+ next if type =~ /^Imports/
+ Import::Base.where(type: type).update_all type: "Import::#{type.gsub 'Import', ''}"
+ end
+ end
+end