Added dedicated data migartion #2659

This commit is contained in:
Priit Tark 2015-06-01 11:41:42 +03:00
parent f1ebedc234
commit b10f62f539
5 changed files with 28 additions and 4 deletions

View file

@ -1,5 +1,5 @@
class UpdateCertsAddCnFromCsr < ActiveRecord::Migration
def change
class AddCertCommonName < ActiveRecord::Migration
def self.up
Certificate.all.each do |x|
if x.crt.blank? && x.csr.present?
pc = x.parsed_csr.try(:subject).try(:to_s) || ''
@ -9,4 +9,8 @@ class UpdateCertsAddCnFromCsr < ActiveRecord::Migration
x.save
end
end
def self.down
raise ActiveRecord::IrreversibleMigration
end
end

View file

@ -1,5 +1,5 @@
class UpdateCerts < ActiveRecord::Migration
def change
class AddCertMd5 < ActiveRecord::Migration
def self.up
Certificate.all.each do |x|
if x.crt.present? && x.csr.present?
x.interface = Certificate::REGISTRAR
@ -21,4 +21,8 @@ class UpdateCerts < ActiveRecord::Migration
x.save
end
end
def self.down
raise ActiveRecord::IrreversibleMigration
end
end