U-D/U-E/O5: Prozess-Tester im eigenen Prozess (standardmäßig gesperrt, 15 Negativtests, statischer Wächter), Szenarien und Bericht, Kanalereignisse (API-Eingang ohne Umbau von iCal/Mail), Abschluss nach finanzieller Klärung, Löschfrist 30 Tage
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c255783cec
commit
0689c0a591
68 files changed
+3350
-35
No files matched your search
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* Builds the migrated, empty SQLite template of the process tester's databases (storage/app/sandbox/template.sqlite).
|
||||
* Run at every deployment after the migrations; a run copies it instead of migrating. Touches only that file.
|
||||
*/
|
||||
#[Signature('process:sandbox-template')]
|
||||
#[Description('Build the empty, migrated SQLite template for process tester runs')]
|
||||
class ProcessSandboxTemplate extends Command
|
||||
{
|
||||
public function handle(): int
|
||||
{
|
||||
if (! extension_loaded('pdo_sqlite')) {
|
||||
$this->warn('pdo_sqlite fehlt – der Prozess-Tester bleibt gesperrt.');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
$directory = storage_path('app/sandbox');
|
||||
@mkdir($directory.'/runs', 0775, true);
|
||||
$file = $directory.'/template.building.sqlite';
|
||||
@unlink($file);
|
||||
touch($file);
|
||||
|
||||
config(['database.connections.sandbox_template' => ['driver' => 'sqlite', 'database' => $file, 'prefix' => '', 'foreign_key_constraints' => true]]);
|
||||
// `migrate --database` switches the default connection of this process and does not switch it back.
|
||||
$default = DB::getDefaultConnection();
|
||||
try {
|
||||
Artisan::call('migrate', ['--database' => 'sandbox_template', '--force' => true, '--no-interaction' => true]);
|
||||
} finally {
|
||||
DB::setDefaultConnection($default);
|
||||
DB::purge('sandbox_template');
|
||||
config(['database.connections.sandbox_template' => null]);
|
||||
}
|
||||
|
||||
rename($file, $directory.'/template.sqlite');
|
||||
$this->info('Vorlage erstellt: '.$directory.'/template.sqlite');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user