[Ovirt-devel] [PATCH] xapian migration fix

Scott Seago sseago at redhat.com
Tue Aug 5 14:36:20 UTC 2008


moved default pool creation to migration 11, as it fails in migration 1 without the xapian tables.

Signed-off-by: Scott Seago <sseago at 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




More information about the ovirt-devel mailing list