mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 09:46:09 +02:00
Add certs migration
This commit is contained in:
parent
624f69003b
commit
626905fb49
1 changed files with 15 additions and 0 deletions
15
db/migrate/20150522164020_update_certs.rb
Normal file
15
db/migrate/20150522164020_update_certs.rb
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue