Fix for schema_version checksum table when checking schemas before the table's been added. :)
This commit is contained in:
		| @@ -95,12 +95,21 @@ class SchemaUpdater | |||||||
|     { |     { | ||||||
|         $checksums = array(); |         $checksums = array(); | ||||||
|  |  | ||||||
|  |         PEAR::pushErrorHandling(PEAR_ERROR_EXCEPTION); | ||||||
|  |         try { | ||||||
|             $sv = new Schema_version(); |             $sv = new Schema_version(); | ||||||
|             $sv->find(); |             $sv->find(); | ||||||
|             while ($sv->fetch()) { |             while ($sv->fetch()) { | ||||||
|                 $checksums[$sv->table_name] = $sv->checksum; |                 $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; |         return $checksums; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -112,6 +121,8 @@ class SchemaUpdater | |||||||
|      */ |      */ | ||||||
|     protected function saveChecksum($table, $checksum) |     protected function saveChecksum($table, $checksum) | ||||||
|     { |     { | ||||||
|  |         PEAR::pushErrorHandling(PEAR_ERROR_EXCEPTION); | ||||||
|  |         try { | ||||||
|             $sv = new Schema_version(); |             $sv = new Schema_version(); | ||||||
|             $sv->table_name = $table; |             $sv->table_name = $table; | ||||||
|             $sv->checksum = $checksum; |             $sv->checksum = $checksum; | ||||||
| @@ -121,6 +132,11 @@ class SchemaUpdater | |||||||
|             } else { |             } else { | ||||||
|                 $sv->insert(); |                 $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; |         $this->checksums[$table] = $checksum; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user