mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix database upgrade path
git-svn-id: http://www.observium.org/svn/observer/trunk@2879 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -29,13 +29,14 @@ if (!isset($debug))
|
||||
}
|
||||
}
|
||||
|
||||
$insert = 0;
|
||||
|
||||
if ($db_rev = @dbFetchCell("SELECT version FROM `dbSchema`")) {} else
|
||||
{
|
||||
$db_rev = 0;
|
||||
$insert = 1;
|
||||
}
|
||||
|
||||
$insert = 0;
|
||||
|
||||
# For transition from old system
|
||||
if ($old_rev = @dbFetchCell("SELECT revision FROM `dbSchema`"))
|
||||
{
|
||||
@@ -96,11 +97,14 @@ foreach ($filelist as $file)
|
||||
if (trim($line))
|
||||
{
|
||||
if ($debug) { echo("$line \n"); }
|
||||
$update = mysql_query($line);
|
||||
if (!$update)
|
||||
if ($line[0] != "#")
|
||||
{
|
||||
$err++;
|
||||
if ($debug) { echo(mysql_error() . "\n"); }
|
||||
$update = mysql_query($line);
|
||||
if (!$update)
|
||||
{
|
||||
$err++;
|
||||
if ($debug) { echo(mysql_error() . "\n"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
CREATE TABLE IF NOT EXISTS `alerts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `importance` int(11) NOT NULL DEFAULT '0', `device_id` int(11) NOT NULL, `message` text NOT NULL, `time_logged` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `alerted` smallint(6) NOT NULL DEFAULT '0', KEY `id` (`id`) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
CREATE TABLE IF NOT EXISTS `alerts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `importance` int(11) NOT NULL DEFAULT '0', `device_id` int(11) NOT NULL, `message` text NOT NULL, `time_logged` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `alerted` smallint(6) NOT NULL DEFAULT '0', KEY `id` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
CREATE TABLE IF NOT EXISTS `applications` ( `app_id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `app_type` varchar(64) NOT NULL, PRIMARY KEY (`app_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
CREATE TABLE IF NOT EXISTS `authlog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `user` text NOT NULL, `address` text NOT NULL, `result` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
CREATE TABLE IF NOT EXISTS `bgpPeers` ( `bgpPeer_id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `astext` varchar(64) NOT NULL, `bgpPeerIdentifier` text NOT NULL, `bgpPeerRemoteAs` int(11) NOT NULL, `bgpPeerState` text NOT NULL, `bgpPeerAdminStatus` text NOT NULL, `bgpLocalAddr` text NOT NULL, `bgpPeerRemoteAddr` text NOT NULL, `bgpPeerInUpdates` int(11) NOT NULL, `bgpPeerOutUpdates` int(11) NOT NULL, `bgpPeerInTotalMessages` int(11) NOT NULL, `bgpPeerOutTotalMessages` int(11) NOT NULL, `bgpPeerFsmEstablishedTime` int(11) NOT NULL, `bgpPeerInUpdateElapsedTime` int(11) NOT NULL, PRIMARY KEY (`bgpPeer_id`), KEY `device_id` (`device_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
Reference in New Issue
Block a user