feat: verify active opportunity management and prepare versioned resources

This commit is contained in:
2026-10-09 13:16:41 +02:00
parent 60784a2ed2
commit 9d6176f55b
16 changed files with 419 additions and 43 deletions
@@ -45,6 +45,13 @@ SQL);
public function down(): void
{
$identity = DB::selectOne('SELECT current_database() AS database,inet_server_port() AS port');
if (! (app()->environment('testing') && str_ends_with($identity->database, '_test') && (int) $identity->port === 55441) && ! config('opportunity_resources.authenticated_installation')) {
throw new RuntimeException('Reversão exige QA isolada ou ação autenticada.');
}
if (DB::table('documents')->whereNotNull('storage_encryption')->exists()) {
throw new RuntimeException('Preservar originais cifrados antes de reversão.');
}
foreach (['documents', 'images', 'location_drafts'] as $kind) {
if (DB::table('opportunity_'.$kind)->exists()) {
throw new RuntimeException('Preservar recursos antes de reversão.');
@@ -54,9 +61,6 @@ SQL);
Schema::drop('opportunity_'.$kind);
}
DB::statement('DROP FUNCTION guard_opportunity_resource_delete()');
if (DB::table('documents')->whereNotNull('storage_encryption')->exists()) {
throw new RuntimeException('Preservar originais cifrados antes de reversão.');
}
Schema::table('documents', function (Blueprint $t) {
$t->dropColumn('storage_encryption');
});