Files
Investidor-V2/tools/portal-next-country-install-qa.php
nala 287e991486
tests / ci (push) Waiting to run
oportunidades 7
2026-10-13 11:40:29 +02:00

27 lines
1.4 KiB
PHP

<?php
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
$root = dirname(__DIR__);
require $root.'/vendor/autoload.php';
require __DIR__.'/portal-qa-environment.php';
$target = portalQaEnvironment();
$app = require $root.'/bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
$identity = portalQaAssertTarget($target);
$migration = '2026_10_10_050000_extend_organization_country';
$before = DB::table('migrations')->where('migration', $migration)->exists();
config(['organization_country.authenticated_installation' => true]);
try {
$exit = Artisan::call('migrate', ['--path' => 'database/migrations/'.$migration.'.php', '--force' => true]);
} finally {
config(['organization_country.authenticated_installation' => false]);
}
throw_unless($exit === 0 && Schema::hasColumn('organizations', 'incorporation_country_provenance'), RuntimeException::class, 'QA country extension failed.');
$proof = ['target' => $identity, 'migration' => $migration, 'was_installed' => $before, 'changed' => ! $before, 'new_columns' => 2, 'new_tables' => 0, 'new_organizations' => 0, 'active_writes' => 0, 'mechanism' => 'Guarded QA CLI only; authenticated active installation remains separate'];
file_put_contents($root.'/storage/app/private/investmoz-v2/portal-audit/next-country-install-qa.json', json_encode($proof, JSON_PRETTY_PRINT));
echo json_encode($proof).PHP_EOL;