wtf
All checks were successful
CI - Build Tonehaus Docker image / tonehaus-ci-build (push) Successful in 2m0s
All checks were successful
CI - Build Tonehaus Docker image / tonehaus-ci-build (push) Successful in 2m0s
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Config\DoctrineConfig;
|
||||
|
||||
return static function (DoctrineConfig $doctrine): void {
|
||||
@@ -32,6 +33,19 @@ return static function (DoctrineConfig $doctrine): void {
|
||||
if ($hasCustomPath) {
|
||||
$connection->path('%env(resolve:DATABASE_SQLITE_PATH)%');
|
||||
} else {
|
||||
$projectDir = dirname(__DIR__, 2);
|
||||
$databasePath = sprintf('%s/var/data/database.sqlite', $projectDir);
|
||||
$databaseDir = dirname($databasePath);
|
||||
|
||||
$filesystem = new Filesystem();
|
||||
if (!$filesystem->exists($databaseDir)) {
|
||||
$filesystem->mkdir($databaseDir, 0o775);
|
||||
}
|
||||
|
||||
if (!$filesystem->exists($databasePath)) {
|
||||
$filesystem->touch($databasePath);
|
||||
}
|
||||
|
||||
$connection->path('%kernel.project_dir%/var/data/database.sqlite');
|
||||
}
|
||||
} else {
|
||||
@@ -39,5 +53,4 @@ return static function (DoctrineConfig $doctrine): void {
|
||||
$connection->serverVersion('16');
|
||||
$connection->charset('utf8');
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user