3 lines
900 B
PHP
3 lines
900 B
PHP
<?php
|
|
$book=$argv[1]??'regression';require __DIR__.'/sgf-single-bootstrap.php';if(!$host->getSchemaBuilder()->hasTable('cq_versions'))$host->transaction(function()use($host,$repo){$host->unprepared(file_get_contents($repo.'/database/sql/commercial_quotes.sql'));foreach(['cq_versions','cq_commands','cq_conversions'] as $table){$host->unprepared('CREATE TRIGGER cq_immutable BEFORE UPDATE OR DELETE ON '.$table.' FOR EACH ROW EXECUTE FUNCTION sgf_append_only_audit()');$host->unprepared('CREATE TRIGGER cq_testing BEFORE INSERT ON '.$table.' FOR EACH ROW EXECUTE FUNCTION sgf_wo_test_only()');$host->statement('REVOKE ALL ON TABLE '.$table.' FROM PUBLIC');$host->statement('REVOKE ALL ON SEQUENCE '.$table.'_id_seq FROM PUBLIC');}$host->statement('REVOKE ALL ON FUNCTION sgf_cq_guard() FROM PUBLIC');});echo json_encode(['passed'=>true,'book'=>$book,'business_commands'=>0,'new_grants'=>0]).PHP_EOL;
|