commit compras2 2911
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-29 10:48:22 +02:00
parent 448948a487
commit 7da8d6c87a
64 changed files with 2538 additions and 288 deletions
@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
// Explicit installation path; never discovered by the application's normal migrate command.
return new class extends Migration
{
public function up(): void
{
$db = DB::connection();
if ($db->getDriverName() !== 'pgsql') {
throw new LogicException('COMPRAS_RUNTIME_DATABASE_DRIVER');
}
$db->getSchemaBuilder()->create('compras_runtime_installations', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('product', 20);
$table->string('contract', 60);
$table->string('manifest_sha256', 64);
$table->string('database_binding_sha256', 64);
$table->string('recorded_by', 200);
$table->text('reason');
$table->timestampTz('installed_at');
});
$db->unprepared("CREATE FUNCTION compras_runtime_preserve() RETURNS trigger LANGUAGE plpgsql AS \$\$
BEGIN RAISE EXCEPTION 'Preserve standalone installation history'; END \$\$;
CREATE TRIGGER compras_runtime_immutable BEFORE UPDATE OR DELETE ON compras_runtime_installations
FOR EACH ROW EXECUTE FUNCTION compras_runtime_preserve();
CREATE TRIGGER compras_runtime_no_truncate BEFORE TRUNCATE ON compras_runtime_installations
FOR EACH STATEMENT EXECUTE FUNCTION compras_runtime_preserve();");
}
public function down(): void
{
throw new LogicException('Preserve standalone installation history; use an explicitly reviewed recovery procedure.');
}
};
@@ -0,0 +1,19 @@
<?php
use App\Services\StandaloneExtensionSchema;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
// Requires a separately recorded explicit installation; no activation or actor grants.
return new class extends Migration
{
public function up(): void
{
StandaloneExtensionSchema::install(DB::connection());
}
public function down(): void
{
throw new LogicException('Use a verified compatible recovery; never delete financial or approval history.');
}
};