Accept isolated WORKSHOP-RESOURCE-RECORD-v1 delivery

Record explicit workshop acceptance and preserve subsequent synthetic work without accepting receivables. Keep 080000/070000 unapplied, real workshop grants pending and operational issuance blocks intact. Exclude local credentials and real-data preservation reports.
This commit is contained in:
2026-10-27 11:28:34 +02:00
parent 4276aca5c2
commit 21a91f2aff
47 changed files with 2774 additions and 6 deletions
@@ -0,0 +1,18 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration {
public function up(): void
{
$old=substr(DB::selectOne("SELECT pg_get_constraintdef(oid) AS d FROM pg_constraint WHERE conrelid='permission_grants'::regclass AND conname='permission_grants_scope_check'")->d,6);
DB::statement('ALTER TABLE permission_grants DROP CONSTRAINT permission_grants_scope_check');
DB::statement("ALTER TABLE permission_grants ADD CONSTRAINT permission_grants_scope_check CHECK (($old) OR (permission IN ('service_receivables.view','service_receivables.prepare','service_receivables.confirm','service_receivables.allocate','service_receivables.reconcile','service_receivables.correction_request','service_receivables.correction_approve') AND unit_id IS NOT NULL))");
DB::unprepared(file_get_contents(__DIR__.'/../sql/receivables.sql'));
foreach (['sr_records','sr_effects','sr_commands','sr_events','sr_outbox','sr_deliveries'] as $table) {
DB::statement("CREATE TRIGGER {$table}_immutable BEFORE UPDATE OR DELETE ON {$table} FOR EACH ROW EXECUTE FUNCTION sgf_append_only_audit()");
DB::statement("CREATE TRIGGER {$table}_test_only BEFORE INSERT ON {$table} FOR EACH ROW EXECUTE FUNCTION sgf_sr_test_insert()");
}
}
public function down(): void { throw new RuntimeException('Immutable history requires a reviewed preservation procedure.'); }
};
@@ -0,0 +1,18 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration {
public function up(): void
{
$old=substr(DB::selectOne("SELECT pg_get_constraintdef(oid) AS d FROM pg_constraint WHERE conrelid='permission_grants'::regclass AND conname='permission_grants_scope_check'")->d,6);
DB::statement('ALTER TABLE permission_grants DROP CONSTRAINT permission_grants_scope_check');
DB::statement("ALTER TABLE permission_grants ADD CONSTRAINT permission_grants_scope_check CHECK (($old) OR (permission IN ('workshop.view','workshop.open','workshop.assign','workshop.authorize','workshop.record','workshop.verify') AND unit_id IS NOT NULL))");
DB::unprepared(file_get_contents(__DIR__.'/../sql/workshop.sql'));
foreach(['wo_equipment','wo_orders','wo_entries','wo_decisions','wo_commands','wo_events','wo_outbox'] as $table) {
DB::statement("CREATE TRIGGER {$table}_immutable BEFORE UPDATE OR DELETE ON {$table} FOR EACH ROW EXECUTE FUNCTION sgf_append_only_audit()");
DB::statement("CREATE TRIGGER {$table}_test_only BEFORE INSERT ON {$table} FOR EACH ROW EXECUTE FUNCTION sgf_wo_test_only()");
}
}
public function down(): void { throw new RuntimeException('Workshop history requires a reviewed preservation procedure.'); }
};