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,3 +1,7 @@
01.06.2015
* Added separate data update, all data migration locate at db/data, more info 'rake -T data'
29.05.2015 29.05.2015
* Removed old 'iptables_counter_update_command' and added 'iptables_counter_enabled' * Removed old 'iptables_counter_update_command' and added 'iptables_counter_enabled'

View file

@ -53,6 +53,9 @@ gem 'isikukood' # for EE-id validation
# deploy # deploy
gem 'whenever', '~> 0.9.4', require: false gem 'whenever', '~> 0.9.4', require: false
gem 'data_migrate',
github: 'gitlabeu/data_migrate',
ref: '35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81'
# monitors # monitors
gem 'newrelic_rpm', '~> 3.9.9.275' gem 'newrelic_rpm', '~> 3.9.9.275'

View file

@ -8,6 +8,14 @@ GIT
activesupport (>= 3.0, < 6.0) activesupport (>= 3.0, < 6.0)
request_store (~> 1.1.0) request_store (~> 1.1.0)
GIT
remote: git://github.com/gitlabeu/data_migrate.git
revision: 35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81
ref: 35d22b09ff37a4e9d61ab326ad5d8eb0edf1fc81
specs:
data_migrate (1.3.0)
rails (>= 4.1.0)
GIT GIT
remote: git://github.com/gitlabeu/epp.git remote: git://github.com/gitlabeu/epp.git
revision: 505c3f2739eb1da918e54111aecfb138a822739d revision: 505c3f2739eb1da918e54111aecfb138a822739d
@ -507,6 +515,7 @@ DEPENDENCIES
coderay (~> 1.1.0) coderay (~> 1.1.0)
coffee-rails (~> 4.1.0) coffee-rails (~> 4.1.0)
countries (~> 0.10.0) countries (~> 0.10.0)
data_migrate!
database_cleaner (~> 1.3.0) database_cleaner (~> 1.3.0)
deep_cloneable (~> 2.1.1) deep_cloneable (~> 2.1.1)
devise (~> 3.4.1) devise (~> 3.4.1)

View file

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

View file

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