From d2638e733ebe23241d110af5fdb59d7b95c1e9b6 Mon Sep 17 00:00:00 2001 From: MoisesMachado Date: Tue, 8 Jul 2008 21:27:10 +0000 Subject: [PATCH] ActionItem527: fixed the migration that changes some regionsn to states and cities and added down --- db/migrate/044_update_regions_to_become_states_and_cities.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/migrate/044_update_regions_to_become_states_and_cities.rb b/db/migrate/044_update_regions_to_become_states_and_cities.rb index 11ddb50..5cb96e7 100644 --- a/db/migrate/044_update_regions_to_become_states_and_cities.rb +++ b/db/migrate/044_update_regions_to_become_states_and_cities.rb @@ -1,10 +1,11 @@ class UpdateRegionsToBecomeStatesAndCities < ActiveRecord::Migration def self.up - 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'))" + 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'))" execute "update categories set type = 'City' where parent_id in (select id from categories where type = 'State')" end def self.down + execute "update categories set type = 'Region' where type = 'State' or type = 'City'" end end -- libgit2 0.21.2