8 lines
774 B
PHP
8 lines
774 B
PHP
<?php
|
|
require __DIR__.'/boot-QA.php';
|
|
use Illuminate\Support\Facades\DB;
|
|
DB::beginTransaction();DB::statement('SET TRANSACTION READ ONLY');$hashes=[];
|
|
foreach(DB::select("SELECT tablename FROM pg_tables WHERE schemaname='public' ORDER BY tablename") as $t){$name=$t->tablename;$quoted='"'.str_replace('"','""',$name).'"';$hashes[$name]=DB::selectOne("SELECT md5(COALESCE(jsonb_agg(to_jsonb(t) ORDER BY to_jsonb(t)::text),'[]'::jsonb)::text) AS hash FROM $quoted t")->hash;}
|
|
$zones=DB::table('investment_zones')->orderBy('id')->get()->toArray();
|
|
DB::rollBack();file_put_contents(dirname($source).'/baseline-QA.json',json_encode(['hashes'=>$hashes,'zones'=>$zones],JSON_THROW_ON_ERROR));echo json_encode(['target'=>$target,'tables'=>count($hashes),'private_baseline'=>true]);
|