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:
Tom Laermans
2012-02-19 18:41:53 +00:00
parent cfb886a394
commit 3ea756ae1b
2 changed files with 11 additions and 7 deletions

View File

@@ -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"); }
}
}
}
}