diff --git a/db/migrate/20150522164020_update_certs.rb b/db/migrate/20150522164020_update_certs.rb new file mode 100644 index 000000000..5b492b271 --- /dev/null +++ b/db/migrate/20150522164020_update_certs.rb @@ -0,0 +1,15 @@ +class UpdateCerts < ActiveRecord::Migration + def change + Certificate.all.each do |x| + if x.crt.present? && x.csr.present? + x.interface = Certificate::REGISTRAR + x.md5 = OpenSSL::Digest::MD5.new(x.parsed_crt.to_der).to_s + elsif x.crt.present? && x.csr.blank? + x.interface = Certificate::API + x.md5 = OpenSSL::Digest::MD5.new(x.parsed_crt.to_der).to_s + elsif x.crt.blank? && x.csr.present? + x.interface = Certificate::REGISTRAR + end + end + end +end