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.
This commit is contained in:
Mateusz Uzdowski 2012-10-17 11:53:35 +13:00
parent c0aad11170
commit 8acc5c4851

View File

@ -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();