one30-onedb-locking-error-while-db-upgrade-fix.diff
onedb/2.9.80_to_2.9.85.rb 2011-10-05 19:10:50.000000000 +0200 | ||
---|---|---|
32 | 32 |
# Image pool table: |
33 | 33 |
# CREATE TABLE image_pool (oid INTEGER PRIMARY KEY, name VARCHAR(256), body TEXT, uid INTEGER, gid INTEGER, public INTEGER, UNIQUE(name,uid) ); |
34 | 34 | |
35 |
@db.fetch("SELECT * FROM image_pool") do |row| |
|
35 |
@db.run "ALTER TABLE image_pool RENAME TO old_image_pool;" |
|
36 |
@db.run "CREATE TABLE image_pool (oid INTEGER PRIMARY KEY, name VARCHAR(256), body TEXT, uid INTEGER, gid INTEGER, public INTEGER, UNIQUE(name,uid) );" |
|
37 |
@db.run "INSERT INTO image_pool SELECT * FROM old_image_pool;" |
|
38 | ||
39 |
@db.fetch("SELECT * FROM old_image_pool") do |row| |
|
36 | 40 |
doc = Document.new(row[:body]) |
37 | 41 | |
38 | 42 |
source = nil |
... | ... | |
51 | 55 |
@db[:image_pool].filter(:oid => row[:oid]).update( |
52 | 56 |
:body => doc.root.to_s) |
53 | 57 |
end |
58 |
@db.run "DROP TABLE old_image_pool;" |
|
54 | 59 | |
55 | 60 |
return true |
56 | 61 |
end |
onedb/2.9.90_to_3.0.0.rb 2011-10-05 19:18:24.000000000 +0200 | ||
---|---|---|
29 | 29 |
# The tm_nfs driver has been renamed to tm_shared |
30 | 30 |
# CREATE TABLE host_pool (oid INTEGER PRIMARY KEY, name VARCHAR(256), body TEXT, state INTEGER, last_mon_time INTEGER, UNIQUE(name)); |
31 | 31 | |
32 |
@db.fetch("SELECT * FROM host_pool") do |row| |
|
32 |
@db.run "ALTER TABLE host_pool RENAME TO old_host_pool;" |
|
33 |
@db.run "CREATE TABLE host_pool (oid INTEGER PRIMARY KEY, name VARCHAR(256), body TEXT, state INTEGER, last_mon_time INTEGER, UNIQUE(name));" |
|
34 |
@db.run "INSERT INTO host_pool SELECT * FROM old_host_pool;" |
|
35 | ||
36 |
@db.fetch("SELECT * FROM old_host_pool") do |row| |
|
33 | 37 |
doc = Document.new(row[:body]) |
34 | 38 | |
35 | 39 |
source = nil |
... | ... | |
42 | 46 |
end |
43 | 47 |
} |
44 | 48 |
end |
49 |
@db.run "DROP TABLE old_host_pool;" |
|
45 | 50 | |
46 | 51 |
return true |
47 | 52 |
end |