[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Ovirt-devel] [PATCH] xapian migration fix



On Tue, Aug 05, 2008 at 10:36:20AM -0400, Scott Seago wrote:
> moved default pool creation to migration 11, as it fails in migration 1 without the xapian tables.
> 
> Signed-off-by: Scott Seago <sseago redhat com>
> ---
>  wui/src/db/migrate/001_create_pools.rb          |    1 -
>  wui/src/db/migrate/011_create_acts_as_xapian.rb |    8 ++++++++
>  2 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/wui/src/db/migrate/001_create_pools.rb b/wui/src/db/migrate/001_create_pools.rb
> index 34c01d3..113a7a9 100644
> --- a/wui/src/db/migrate/001_create_pools.rb
> +++ b/wui/src/db/migrate/001_create_pools.rb
> @@ -31,7 +31,6 @@ class CreatePools < ActiveRecord::Migration
>  
>      execute "alter table pools add constraint fk_pool_parent
>               foreign key (parent_id) references pools(id)"
> -    mp = HardwarePool.create( :name=>'default')
>    end
>  
>    def self.down
> diff --git a/wui/src/db/migrate/011_create_acts_as_xapian.rb b/wui/src/db/migrate/011_create_acts_as_xapian.rb
> index 84a9dd7..3655f8e 100644
> --- a/wui/src/db/migrate/011_create_acts_as_xapian.rb
> +++ b/wui/src/db/migrate/011_create_acts_as_xapian.rb
> @@ -6,9 +6,17 @@ class CreateActsAsXapian < ActiveRecord::Migration
>        t.column :action, :string, :null => false
>      end
>      add_index :acts_as_xapian_jobs, [:model, :model_id], :unique => true
> +
> +    begin
> +      root_pool = HardwarePool.get_default_pool
> +      new_root = HardwarePool.create( :name=>'default') unless root_pool
> +    rescue
> +      puts "Could not create default pool..."
> +    end
>    end
>    def self.down
>      drop_table :acts_as_xapian_jobs
>    end
> +
>  end
>  
> -- 
> 1.5.5.1
> 

Works for me. ACK.

> _______________________________________________
> Ovirt-devel mailing list
> Ovirt-devel redhat com
> https://www.redhat.com/mailman/listinfo/ovirt-devel


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]