Commit a4d0533b authored by Leigh B Stoller's avatar Leigh B Stoller

Add gid to various apt tables, subgroups they are a coming.

parent 8b52132b
......@@ -55,7 +55,7 @@ CREATE TABLE `active_checkups` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `apt_datasets`
-- Table structure for table `apt_aggregates`
--
DROP TABLE IF EXISTS `apt_aggregates`;
......@@ -87,6 +87,8 @@ CREATE TABLE `apt_datasets` (
`uuid` varchar(40) NOT NULL default '',
`pid` varchar(48) NOT NULL default '',
`pid_idx` mediumint(8) unsigned NOT NULL default '0',
`gid` varchar(32) NOT NULL default '',
`gid_idx` mediumint(8) unsigned NOT NULL default '0',
`creator_uid` varchar(8) NOT NULL default '',
`creator_idx` mediumint(8) unsigned NOT NULL default '0',
`aggregate_urn` varchar(128) default NULL,
......@@ -185,6 +187,8 @@ CREATE TABLE `apt_instance_failures` (
`creator_uuid` varchar(40) NOT NULL default '',
`pid` varchar(48) default NULL,
`pid_idx` mediumint(8) unsigned default NULL,
`gid` varchar(32) NOT NULL default '',
`gid_idx` mediumint(8) unsigned NOT NULL default '0',
`created` datetime default NULL,
`exitcode` int(10) default '0',
`exitmessage` mediumtext,
......@@ -209,6 +213,8 @@ CREATE TABLE `apt_instance_history` (
`creator_uuid` varchar(40) NOT NULL default '',
`pid` varchar(48) default NULL,
`pid_idx` mediumint(8) unsigned default NULL,
`gid` varchar(32) NOT NULL default '',
`gid_idx` mediumint(8) unsigned NOT NULL default '0',
`aggregate_urn` varchar(128) default NULL,
`public_url` tinytext,
`logfileid` varchar(40) default NULL,
......@@ -243,6 +249,8 @@ CREATE TABLE `apt_instances` (
`creator_uuid` varchar(40) NOT NULL default '',
`pid` varchar(48) default NULL,
`pid_idx` mediumint(8) unsigned default NULL,
`gid` varchar(32) NOT NULL default '',
`gid_idx` mediumint(8) unsigned NOT NULL default '0',
`aggregate_urn` varchar(128) default NULL,
`public_url` tinytext,
`created` datetime default NULL,
......@@ -303,6 +311,8 @@ CREATE TABLE `apt_profile_versions` (
`version` int(8) unsigned NOT NULL default '0',
`pid` varchar(48) NOT NULL default '',
`pid_idx` mediumint(8) unsigned NOT NULL default '0',
`gid` varchar(32) NOT NULL default '',
`gid_idx` mediumint(8) unsigned NOT NULL default '0',
`creator` varchar(8) NOT NULL default '',
`creator_idx` mediumint(8) unsigned NOT NULL default '0',
`created` datetime default NULL,
......@@ -331,6 +341,8 @@ CREATE TABLE `apt_profiles` (
`version` int(8) unsigned NOT NULL default '0',
`pid` varchar(48) NOT NULL default '',
`pid_idx` mediumint(8) unsigned NOT NULL default '0',
`gid` varchar(32) NOT NULL default '',
`gid_idx` mediumint(8) unsigned NOT NULL default '0',
`uuid` varchar(40) NOT NULL,
`public` tinyint(1) NOT NULL default '0',
`shared` tinyint(1) NOT NULL default '0',
......
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBSlotExists("apt_datasets", "gid")) {
DBQueryFatal("alter table apt_datasets ".
" add `gid` varchar(32) NOT NULL default '' ".
" after pid_idx, ".
" add `gid_idx` mediumint(8) unsigned NOT NULL default '0' ".
" after gid");
DBQueryFatal("update apt_datasets set gid=pid,gid_idx=pid_idx");
}
if (!DBSlotExists("apt_instance_failures", "gid")) {
DBQueryFatal("alter table apt_instance_failures ".
" add `gid` varchar(32) NOT NULL default '' ".
" after pid_idx, ".
" add `gid_idx` mediumint(8) unsigned NOT NULL default '0' ".
" after gid");
DBQueryFatal("update apt_instance_failures set gid=pid,gid_idx=pid_idx");
}
if (!DBSlotExists("apt_instance_history", "gid")) {
DBQueryFatal("alter table apt_instance_history ".
" add `gid` varchar(32) NOT NULL default '' ".
" after pid_idx, ".
" add `gid_idx` mediumint(8) unsigned NOT NULL default '0' ".
" after gid");
DBQueryFatal("update apt_instance_history set gid=pid,gid_idx=pid_idx");
}
if (!DBSlotExists("apt_instances", "gid")) {
DBQueryFatal("alter table apt_instances ".
" add `gid` varchar(32) NOT NULL default '' ".
" after pid_idx, ".
" add `gid_idx` mediumint(8) unsigned NOT NULL default '0' ".
" after gid");
DBQueryFatal("update apt_instances set gid=pid,gid_idx=pid_idx");
}
if (!DBSlotExists("apt_profile_versions", "gid")) {
DBQueryFatal("alter table apt_profile_versions ".
" add `gid` varchar(32) NOT NULL default '' ".
" after pid_idx, ".
" add `gid_idx` mediumint(8) unsigned NOT NULL default '0' ".
" after gid");
DBQueryFatal("update apt_profile_versions set gid=pid,gid_idx=pid_idx");
}
if (!DBSlotExists("apt_profiles", "gid")) {
DBQueryFatal("alter table apt_profiles ".
" add `gid` varchar(32) NOT NULL default '' ".
" after pid_idx, ".
" add `gid_idx` mediumint(8) unsigned NOT NULL default '0' ".
" after gid");
DBQueryFatal("update apt_profiles set gid=pid,gid_idx=pid_idx");
}
return 0;
}
# Local Variables:
# mode:perl
# End:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment