From 8acc5c485184a08a80503a66fed3d94151014236 Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Wed, 17 Oct 2012 11:53:35 +1300 Subject: [PATCH] BUG Do not populate defaults when updating schema. This breaks the dev/build if the table is not ready or has been modified. The default record will be created later anyway. --- code/model/Translatable.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/model/Translatable.php b/code/model/Translatable.php index b6bc768..bac6bfa 100755 --- a/code/model/Translatable.php +++ b/code/model/Translatable.php @@ -1193,10 +1193,10 @@ class Translatable extends DataExtension implements PermissionProvider { */ protected function populateSiteConfigDefaults() { - // Work-around for population of defaults during database initialisation. - // When the database is being setup singleton('SiteConfig') is called. - if(!DB::getConn()->hasTable($this->owner->class)) return; - if(!DB::getConn()->hasField($this->owner->class, 'Locale')) return; + // When the database is being setup singleton('SiteConfig') is called, + // but the SiteConfig table might not be ready yet and the queries will break. + // Skip the population of defaults in this case. + if(DB::getConn()->isSchemaUpdating()) return; // Find the best base translation for SiteConfig Translatable::disable_locale_filter();