Commit d2638e733ebe23241d110af5fdb59d7b95c1e9b6

Authored by MoisesMachado
1 parent e483adc3

ActionItem527: fixed the migration that changes some regionsn to states and cities and added down


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2172 3f533792-8f58-4932-b0fe-aaf55b0a4547
db/migrate/044_update_regions_to_become_states_and_cities.rb
1 1 class UpdateRegionsToBecomeStatesAndCities < ActiveRecord::Migration
2 2 def self.up
3   - execute "update categories set type = 'State' where (select id from categories where type = 'Region' and parent_id in (select id from categories where type = 'Region' and name = 'Nacional'))"
  3 + execute "update categories set type = 'State' where parent_id in (select id from categories where type = 'Region' and parent_id in (select id from categories where type = 'Region' and name = 'Nacional'))"
4 4  
5 5 execute "update categories set type = 'City' where parent_id in (select id from categories where type = 'State')"
6 6 end
7 7  
8 8 def self.down
  9 + execute "update categories set type = 'Region' where type = 'State' or type = 'City'"
9 10 end
10 11 end
... ...