diff --git a/sql/database-create.sql b/sql/database-create.sql index de7874f1cda97694199883e2dd5acfc8b924b09c..68831bf766ad1354494d5af2e9bd9163a3a99f1c 100644 --- a/sql/database-create.sql +++ b/sql/database-create.sql @@ -210,13 +210,14 @@ CREATE TABLE `blockstores` ( `bsidx` int(10) unsigned NOT NULL, `node_id` varchar(32) NOT NULL default '', `bs_id` varchar(32) NOT NULL default '', + `lease_idx` int(10) unsigned NOT NULL default '0', `type` varchar(30) NOT NULL default '', - `role` enum('element','compound') NOT NULL default 'element', + `role` enum('element','compound','partition') NOT NULL default 'element', `total_size` int(10) unsigned NOT NULL default '0', `exported` tinyint(1) NOT NULL default '0', `inception` datetime default NULL, PRIMARY KEY (`bsidx`), - UNIQUE KEY nidbid (`node_id`,`bs_id`) + UNIQUE KEY nidbid (`node_id`,`bs_id`,`lease_idx`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- diff --git a/sql/updates/4/369 b/sql/updates/4/369 new file mode 100644 index 0000000000000000000000000000000000000000..0da1f18210517231c19e9f27e481c43d3cd5cb77 --- /dev/null +++ b/sql/updates/4/369 @@ -0,0 +1,30 @@ +# +# Support for persistent stores. +# Add lease_idx to blockstores table and add 'partition' role. +# +use strict; +use libdb; + +sub DoUpdate($$$) +{ + my ($dbhandle, $dbname, $version) = @_; + + if (!DBSlotExists("blockstores", "lease_idx")) { + DBQueryFatal("alter table blockstores add ". + " `lease_idx` int(10) unsigned NOT NULL default '0' ". + "after bs_id"); + DBQueryFatal("alter table blockstores drop ". + "index nidbid"); + DBQueryFatal("alter table blockstores add ". + "UNIQUE KEY nidbid (node_id,bs_id,lease_idx)"); + DBQueryFatal("alter table blockstores change role ". + "role enum('element','compound','partition') ". + "NOT NULL default 'element'"); + } + return 0; + +} + +# Local Variables: +# mode:perl +# End: