Preserva classificacao contabilistica aceite e bases locais
Regista aceitacao funcional do primeiro incremento PGC-NIRF e preserva as dependencias documentais e tecnicas existentes. A validacao do calculo fiscal continua separada e pendente. Sem credenciais, bases operacionais ou publicacao.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
$app=require __DIR__.'/../bootstrap/app.php';
|
||||
$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
||||
$db=\Illuminate\Support\Facades\DB::class;
|
||||
if (app()->environment()!=='local' || $db::selectOne('select current_database() as db')->db!=='sgf_tempo_dev') { throw new RuntimeException('Development preservation destination refused.'); }
|
||||
$summary=[];
|
||||
foreach (['a_clients','a_services','a_service_drafts','a_billing_drafts','a_history','a_events','a_outbox','a_pending','b_internal_confirmations','doc_records','doc_history','document_preview_models','document_preview_model_history','permission_grants'] as $table) {
|
||||
$rows=$db::table($table)->orderBy($table==='a_outbox' ? 'event_id' : 'id')->get(); $summary[$table]=['count'=>$rows->count(),'sha256'=>hash('sha256',$rows->toJson())];
|
||||
}
|
||||
$file=storage_path('app/calculation-preservation-before.json');
|
||||
if (in_array('--before',$argv,true)) { file_put_contents($file,json_encode($summary,JSON_THROW_ON_ERROR)); echo "Development preservation fingerprints captured; no contents displayed.\n"; }
|
||||
else {
|
||||
if ($summary!==json_decode(file_get_contents($file),true,32,JSON_THROW_ON_ERROR)) { throw new RuntimeException('Existing records changed during migration.'); }
|
||||
foreach (['service_calculation_profiles','service_calculation_results'] as $table) { if ($db::table($table)->count()!==0) { throw new RuntimeException('Unexpected development calculation records.'); } }
|
||||
file_put_contents(base_path('docs/proofs/calculation-dev-preservation.json'),json_encode(['database'=>'sgf_tempo_dev','existing_tables_compared'=>array_keys($summary),'identical_counts_and_content_hashes'=>true,'new_profiles'=>0,'new_results'=>0],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));
|
||||
echo "Development migration verified: existing records identical; zero profiles and zero results.\n";
|
||||
}
|
||||
Reference in New Issue
Block a user