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

Add extension counters to apt_instances and instance_history tables.

Number of extension where days where granted, and total number of
days added for all extensions.
parent a52192e8
......@@ -411,8 +411,9 @@ sub RecordHistory($)
DBQueryWarn("replace into apt_instance_history ".
"select uuid,profile_id,profile_version,slice_uuid, ".
" creator,creator_idx,creator_uuid,pid,pid_idx, ".
" aggregate_urn,public_url,created,now(),servername, ".
" rspec,params,manifest ".
" aggregate_urn,public_url,created,now(), ".
" extension_count,extension_days, ".
" servername,rspec,params,manifest ".
" from apt_instances where uuid='$uuid'")
or return -1;
......
......@@ -108,6 +108,8 @@ CREATE TABLE `apt_instance_history` (
`public_url` tinytext,
`created` datetime default NULL,
`destroyed` datetime default NULL,
`extension_count` smallint(5) unsigned NOT NULL default '0',
`extension_days` smallint(5) unsigned NOT NULL default '0',
`servername` tinytext,
`rspec` mediumtext,
`params` mediumtext,
......@@ -139,6 +141,8 @@ CREATE TABLE `apt_instances` (
`extension_code` varchar(32) default NULL,
`extension_reason` mediumtext,
`extension_adminonly` tinyint(1) NOT NULL default '0',
`extension_count` smallint(5) unsigned NOT NULL default '0',
`extension_days` smallint(5) unsigned NOT NULL default '0',
`servername` tinytext,
`monitor_pid` int(11) default '0',
`rspec` mediumtext,
......
#
# APT Stuff.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBSlotExists("apt_instances", "extension_count")) {
DBQueryFatal("alter table apt_instances add ".
" `extension_count` smallint(5) unsigned ".
" NOT NULL default '0' ".
" after extension_adminonly");
}
if (!DBSlotExists("apt_instances", "extension_days")) {
DBQueryFatal("alter table apt_instances add ".
" `extension_days` smallint(5) unsigned ".
" NOT NULL default '0' ".
" after extension_count");
}
if (!DBSlotExists("apt_instance_history", "extension_count")) {
DBQueryFatal("alter table apt_instance_history add ".
" `extension_count` smallint(5) unsigned ".
" NOT NULL default '0' ".
" after destroyed");
}
if (!DBSlotExists("apt_instance_history", "extension_days")) {
DBQueryFatal("alter table apt_instance_history add ".
" `extension_days` smallint(5) unsigned ".
" NOT NULL default '0' ".
" after extension_count");
}
return 0;
}
1;
# 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