Update legacy registrar codes just in case

This commit is contained in:
Priit Tark 2015-05-04 14:15:09 +03:00
parent 8f23ef510d
commit 2e4bf0ee6e
2 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,12 @@
class ValidateRegistrarCodes < ActiveRecord::Migration
def change
Registrar.all.each do |registrar|
if registrar.code.present?
registrar.update_column(:code, registrar.code.gsub(/[ :]/, '').upcase)
else
puts "NB! FOUND REGISTRAR WITHOUT CODE (HANDLER): #{registrar.id}; #{registrar.name}"
puts "Please add registrar code manually in database!"
end
end
end
end

View file

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150504104922) do ActiveRecord::Schema.define(version: 20150504110926) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"