11 lines
2.1 KiB
PHP
11 lines
2.1 KiB
PHP
<?php
|
|
require __DIR__.'/boot-QA.php';
|
|
$db=Illuminate\Support\Facades\DB::connection();$db->beginTransaction();$db->statement('SET TRANSACTION READ ONLY');
|
|
try{
|
|
$source=new PDO('pgsql:host=127.0.0.1;port=55441;dbname=parks_l1_20261016_test','postgres','');$source->exec('BEGIN READ ONLY');$source->exec("SET LOCAL TIME ZONE 'UTC'");$db->statement("SET LOCAL TIME ZONE 'UTC'");
|
|
$id='0ae14c9a-1adb-4ee7-8094-d5d54d4e75f1';$rows=$source->query("SELECT id,row_to_json(t)::text AS body FROM investment_zones t WHERE id<>'$id' ORDER BY id")->fetchAll(PDO::FETCH_KEY_PAIR);$same=0;foreach($db->select('SELECT id,row_to_json(t)::text AS body FROM investment_zones t WHERE id<>? ORDER BY id',[$id])as$r){if(($rows[$r->id]??null)!==$r->body)throw new RuntimeException('Another zone changed');$same++;}
|
|
$tables=[];foreach(['organizations','memberships','documents','investment_zone_attachments','investment_zone_geometries','investment_zone_links','opportunities','desk_cases','investment_submissions','interest_requests']as$table){$sql='SELECT row_to_json(t)::text AS body FROM '.$table.' t ORDER BY row_to_json(t)::text';$a=$source->query($sql)->fetchAll(PDO::FETCH_COLUMN);$b=array_map(fn($r)=>$r->body,$db->select($sql));if($a!==$b)throw new RuntimeException('Unrelated table changed: '.$table);$tables[$table]=count($a);}
|
|
$ledgers=[];foreach(['2026_10_16_130000_add_investment_zone_editorial_draft','2026_10_16_140000_add_investment_zone_operational_details','2026_10_16_150000_create_investor_navigation_preferences']as$m)$ledgers[$m]=$db->table('migrations')->where('migration',$m)->count();if(array_values($ledgers)!==[1,1,1])throw new RuntimeException('Installed QA base must be preserved');
|
|
$proof=['target'=>$target,'other_zones_byte_identical'=>$same,'unchanged_related_tables'=>$tables,'ledger'=>$ledgers,'masters_created'=>0,'business_rows_outside_fixture_changed'=>0,'active_connections'=>0,'active_changes'=>0];file_put_contents(__DIR__.'/PRESERVACAO-QA.json',json_encode($proof,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));echo json_encode($proof).PHP_EOL;$source->exec('ROLLBACK');
|
|
}finally{$db->rollBack();}
|