mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
23 lines
624 B
PHP
23 lines
624 B
PHP
<?php
|
|
|
|
// This migration is always executed (on every migration run, not only once)
|
|
|
|
// This is executed inside DatabaseMigrationService class/context
|
|
|
|
// When FEATURE_FLAG_STOCK_LOCATION_TRACKING is disabled,
|
|
// some places assume that there exists a location with id 1,
|
|
// so make sure that this location is available in that case
|
|
if (!GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
|
{
|
|
$db = $this->getDatabaseService()->GetDbConnection();
|
|
|
|
if ($db->locations()->where('id', 1)->count() === 0)
|
|
{
|
|
$defaultLocation = $db->locations()->createRow([
|
|
'id' => 1,
|
|
'name' => 'Default'
|
|
]);
|
|
$defaultLocation->save();
|
|
}
|
|
}
|