11 1.38 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
#
# Tweaks to history code.
#
use strict;
use GeniDB;

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

    DBSetDefault($dbhandle);

Leigh B. Stoller's avatar
Leigh B. Stoller committed
13
14
15
16
17
18
19
20
21
22
23
    if (!DBTableExists("geni_crls")) {
	DBQueryFatal("CREATE TABLE `geni_crls` ( ".
		     " `uuid` varchar(40) NOT NULL default '', ".
		     " `created` datetime default NULL, ".
		     " `expires` datetime default NULL, ".
		     " `cert` text, ".
		     " `DN` text, ".
		     " PRIMARY KEY  (`uuid`) ".
		     ") ENGINE=MyISAM DEFAULT CHARSET=latin1");
    }
    elsif (!DBSlotExists("geni_crls", "DN")) {
24
25
	DBQueryFatal("alter table geni_crls add `DN` text");
    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
26
    if (DBSlotExists("ticket_history", "target_uuid")) {
27
28
	DBQueryFatal("alter table ticket_history drop target_uuid");
    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
29
    if (DBSlotExists("ticket_history", "target_hrn")) {
30
31
	DBQueryFatal("alter table ticket_history drop target_hrn");
    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
32
    if (DBSlotExists("aggregate_history", "aggregate_uuid")) {
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	DBQueryFatal("alter table aggregate_history drop aggregate_uuid");
    }
    if (!DBTableExists("manifest_history")) {
	DBQueryFatal("CREATE TABLE `manifest_history` ( ".
		     " `idx` int(10) unsigned NOT NULL auto_increment, ".
		     " `aggregate_uuid` varchar(40) NOT NULL default '', ".
		     " `created` datetime default NULL, ".
		     " `manifest` text, ".
		     " PRIMARY KEY  (`idx`) ".
		     ") ENGINE=MyISAM DEFAULT CHARSET=latin1");
    }
    return 0;
}
1;