Accept isolated budget versus actual trial with documented capture limitation
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?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 ('industrial_budgets.view','industrial_budgets.prepare','industrial_budgets.validate','industrial_budget_comparisons.view','industrial_budget_comparisons.prepare') AND unit_id IS NOT NULL))");
|
||||
DB::unprepared(file_get_contents(__DIR__.'/../sql/industrial-budgets.sql'));
|
||||
foreach(['ib_budgets','ib_decisions','ib_comparisons','ib_commands','ib_events','ib_outbox'] as $t){
|
||||
DB::statement("CREATE TRIGGER {$t}_immutable BEFORE UPDATE OR DELETE ON {$t} FOR EACH ROW EXECUTE FUNCTION sgf_append_only_audit()");
|
||||
DB::statement("CREATE TRIGGER {$t}_environment BEFORE INSERT ON {$t} FOR EACH ROW EXECUTE FUNCTION sgf_ic_test_only()");
|
||||
}
|
||||
}
|
||||
public function down(): void {throw new RuntimeException('Budget history requires reviewed preservation.');}
|
||||
};
|
||||
Reference in New Issue
Block a user