Commit 8cdf8cf3 authored by Brion Vibber's avatar Brion Vibber

Fix for schema_version checksum table when checking schemas before the table's been added. :)

parent 836f4ea6
......@@ -95,11 +95,20 @@ class SchemaUpdater
{
$checksums = array();
$sv = new Schema_version();
$sv->find();
while ($sv->fetch()) {
$checksums[$sv->table_name] = $sv->checksum;
PEAR::pushErrorHandling(PEAR_ERROR_EXCEPTION);
try {
$sv = new Schema_version();
$sv->find();
while ($sv->fetch()) {
$checksums[$sv->table_name] = $sv->checksum;
}
return $checksums;
} catch (Exception $e) {
// no dice!
common_log(LOG_DEBUG, "Possibly schema_version table doesn't exist yet.");
}
PEAR::popErrorHandling();
return $checksums;
}
......@@ -112,15 +121,22 @@ class SchemaUpdater
*/
protected function saveChecksum($table, $checksum)
{
$sv = new Schema_version();
$sv->table_name = $table;
$sv->checksum = $checksum;
$sv->modified = common_sql_now();
if (isset($this->checksums[$table])) {
$sv->update();
} else {
$sv->insert();
PEAR::pushErrorHandling(PEAR_ERROR_EXCEPTION);
try {
$sv = new Schema_version();
$sv->table_name = $table;
$sv->checksum = $checksum;
$sv->modified = common_sql_now();
if (isset($this->checksums[$table])) {
$sv->update();
} else {
$sv->insert();
}
} catch (Exception $e) {
// no dice!
common_log(LOG_DEBUG, "Possibly schema_version table doesn't exist yet.");
}
PEAR::popErrorHandling();
$this->checksums[$table] = $checksum;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment