Merge branch 'before_schemaupdate_if_no_table' into 'master'

Don't explode if QvitterNotification has not been created

thanks asterismo

See merge request !64
This commit is contained in:
hannes 2016-09-07 09:09:09 -04:00
commit c6d1296cd7

View File

@ -57,6 +57,15 @@ class QvitterNotification extends Managed_DataObject
static public function beforeSchemaUpdate() static public function beforeSchemaUpdate()
{ {
$table = strtolower(get_called_class());
$schema = Schema::get();
try {
$schemadef = $schema->getTableDef($table);
} catch (SchemaTableMissingException $e) {
printfnq("\nTable '$table' not created yet, so nothing to do with it before Schema Update... DONE.");
return;
}
printfnq("\nEnsuring no NULL values for foreign keys in QvitterNotification..."); printfnq("\nEnsuring no NULL values for foreign keys in QvitterNotification...");
// Because constraints to profile and notice table assume not null, we must // Because constraints to profile and notice table assume not null, we must
// remove any values in these columns that are NULL (or 0), because they // remove any values in these columns that are NULL (or 0), because they