421 1.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
#
# Modify APT tables
#
use strict;
use libdb;

sub DoUpdate($$$)
{
    my ($dbhandle, $dbname, $version) = @_;

    if (!DBSlotExists("apt_instances", "pid")) {
	DBQueryFatal("alter table apt_instances add ".
		     " `pid` varchar(48) default NULL after creator_uuid");
    }
    if (!DBSlotExists("apt_instances", "pid_idx")) {
	DBQueryFatal("alter table apt_instances add ".
		     " `pid_idx` mediumint(8) unsigned default NULL after pid");
    }
    if (!DBSlotExists("apt_instance_history", "pid")) {
 	DBQueryFatal("alter table apt_instance_history add ".
		     " `pid` varchar(48) default NULL after creator_uuid");
    }
    if (!DBSlotExists("apt_instance_history", "pid_idx")) {
	DBQueryFatal("alter table apt_instance_history add ".
		     " `pid_idx` mediumint(8) unsigned default NULL after pid");
    }
    if (!DBKeyExists("experiment_stats", "pid_idx")) {
	DBQueryFatal("alter table experiment_stats add ".
		     "  KEY `pid_idx` (`pid_idx`)");
    }
    if (!DBKeyExists("experiment_stats", "creator_idx")) {
	DBQueryFatal("alter table experiment_stats add ".
		     "  KEY `creator_idx` (`creator_idx`)");
    }

    return 0;
}
1;

# Local Variables:
# mode:perl
# End: