changes migration to update invalid orgs

This commit is contained in:
Juanjo Bazán
2015-09-12 18:41:34 +02:00
parent 40840f74c6
commit eb8d8f4766

View File

@@ -1,5 +1,13 @@
class AddResponsibleNameToOrganizations < ActiveRecord::Migration
def change
def up
add_column :organizations, :responsible_name, :string, limit: 60
Organization.find_each do |org|
org.update(responsible_name: org.name) if org.responsible_name.blank?
end
end
def down
remove_column :organizations, :responsible_name
end
end