diff --git a/db/migrate/20150115050936_add_address_instances_to_existing_enterprise_groups.rb b/db/migrate/20150115050936_add_address_instances_to_existing_enterprise_groups.rb index 0800948126..23fc038ce8 100644 --- a/db/migrate/20150115050936_add_address_instances_to_existing_enterprise_groups.rb +++ b/db/migrate/20150115050936_add_address_instances_to_existing_enterprise_groups.rb @@ -6,7 +6,14 @@ class AddAddressInstancesToExistingEnterpriseGroups < ActiveRecord::Migration next if g.address.present? address = Spree::Address.new(firstname: 'unused', lastname: 'unused', address1: 'undefined', city: 'undefined', zipcode: 'undefined', state: state, country: country, phone: 'undefined') g.address = address - g.save + # some groups are invalid, because of a missing description + g.save!(validate: false) end end + + def self.down + # we can't know which addresses were already there and which weren't + # and we can't remove addresses as long as they are referenced and + # required by the model + end end