@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (app()->environment('testing')) {
|
||||
$target = DB::selectOne('SELECT current_database() AS database, inet_server_port() AS port');
|
||||
throw_unless(str_ends_with($target->database, '_test') && (int) $target->port === 55441, RuntimeException::class, 'Isolated QA required');
|
||||
} else {
|
||||
throw_unless(config('organization_country.authenticated_installation') === true, RuntimeException::class, 'Authenticated organization country installation required');
|
||||
}
|
||||
Schema::table('organizations', function (Blueprint $table): void {
|
||||
$table->string('incorporation_country_code', 2)->nullable();
|
||||
$table->jsonb('incorporation_country_provenance')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
throw new RuntimeException('Country data and provenance must be preserved; disable the consumer or restore the verified candidate clone instead of dropping populated columns.');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user