feat: verify active opportunity management and prepare versioned resources
This commit is contained in:
@@ -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');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user