Add HostStats table to install script.
Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
parent
9ccb915d77
commit
713db80545
|
@ -46,7 +46,7 @@ my $DBCreate = <<SQLDB;
|
||||||
CREATE DATABASE IF NOT EXISTS `$Conf{'DBDatabase'}` DEFAULT CHARSET=utf8;
|
CREATE DATABASE IF NOT EXISTS `$Conf{'DBDatabase'}` DEFAULT CHARSET=utf8;
|
||||||
SQLDB
|
SQLDB
|
||||||
|
|
||||||
my %DBCreate = ('DBTableRaw' => <<RAW, 'DBTableGrps' => <<GRPS);
|
my %DBCreate = ('DBTableRaw' => <<RAW, 'DBTableGrps' => <<GRPS, 'DBTableHosts' => <<HOSTS);
|
||||||
--
|
--
|
||||||
-- Table structure for table DBTableRaw
|
-- Table structure for table DBTableRaw
|
||||||
--
|
--
|
||||||
|
@ -82,10 +82,26 @@ CREATE TABLE IF NOT EXISTS `$Conf{'DBTableGrps'}` (
|
||||||
`revision` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
`revision` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `month_newsgroup` (`month`,`newsgroup`),
|
UNIQUE KEY `month_newsgroup` (`month`,`newsgroup`),
|
||||||
KEY `newsgroup` (`newsgroup`),
|
KEY `month` (`month`),
|
||||||
KEY `postings` (`postings`)
|
KEY `newsgroup` (`newsgroup`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Postings per newsgroup';
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Postings per newsgroup';
|
||||||
GRPS
|
GRPS
|
||||||
|
--
|
||||||
|
-- Table structure for table DBTableHosts
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `$Conf{'DBTableHosts'}` (
|
||||||
|
`id` bigint(20) unsigned NOT NULL auto_increment,
|
||||||
|
`month` varchar(7) character set ascii NOT NULL,
|
||||||
|
`host` varchar(100) NOT NULL,
|
||||||
|
`postings` int(11) NOT NULL,
|
||||||
|
`revision` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `month_host` (`month`,`host`),
|
||||||
|
KEY `month` (`month`),
|
||||||
|
KEY `host` (`host`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Postings per server';
|
||||||
|
HOSTS
|
||||||
|
|
||||||
##### --------------------------------------------------------------------------
|
##### --------------------------------------------------------------------------
|
||||||
##### Installation / upgrade instructions
|
##### Installation / upgrade instructions
|
||||||
|
@ -153,8 +169,8 @@ UPGRADE
|
||||||
if (!$OptUpdate) {
|
if (!$OptUpdate) {
|
||||||
print "----------\nStarting database creation.\n";
|
print "----------\nStarting database creation.\n";
|
||||||
# create database
|
# create database
|
||||||
# we can't use InitDB() as that will use a table name of
|
# we can't use InitDB() as that will use the database name of
|
||||||
# the table that doesn't exist yet ...
|
# the database that doesn't exist yet ...
|
||||||
my $DBHandle = DBI->connect(sprintf('DBI:%s:host=%s',$Conf{'DBDriver'},
|
my $DBHandle = DBI->connect(sprintf('DBI:%s:host=%s',$Conf{'DBDriver'},
|
||||||
$Conf{'DBHost'}), $Conf{'DBUser'},
|
$Conf{'DBHost'}), $Conf{'DBUser'},
|
||||||
$Conf{'DBPw'}, { PrintError => 0 });
|
$Conf{'DBPw'}, { PrintError => 0 });
|
||||||
|
@ -162,7 +178,7 @@ if (!$OptUpdate) {
|
||||||
$DBQuery->execute() or &Bleat(2, sprintf("Can't create database %s: %s%\n",
|
$DBQuery->execute() or &Bleat(2, sprintf("Can't create database %s: %s%\n",
|
||||||
$Conf{'DBDatabase'}, $DBI::errstr));
|
$Conf{'DBDatabase'}, $DBI::errstr));
|
||||||
|
|
||||||
printf("Database table %s created succesfully.\n",$Conf{'DBDatabase'});
|
printf("Database %s created succesfully.\n",$Conf{'DBDatabase'});
|
||||||
$DBHandle->disconnect;
|
$DBHandle->disconnect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -185,7 +201,7 @@ if (!$OptUpdate) {
|
||||||
} else {
|
} else {
|
||||||
##### upgrade mode
|
##### upgrade mode
|
||||||
print "----------\nStarting upgrade process.\n";
|
print "----------\nStarting upgrade process.\n";
|
||||||
$PackageVersion = '0.03';
|
my $PackageVersion = '0.03';
|
||||||
if ($OptUpdate < $PackageVersion) {
|
if ($OptUpdate < $PackageVersion) {
|
||||||
if ($OptUpdate < 0.02) {
|
if ($OptUpdate < 0.02) {
|
||||||
# 0.01 -> 0.02
|
# 0.01 -> 0.02
|
||||||
|
|
Loading…
Reference in a new issue