@@ -0,0 +1,24 @@
|
||||
<?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
|
||||
{
|
||||
Schema::table('tenants', fn (Blueprint $table) => $table->json('requisition_approval_policy')->nullable());
|
||||
Schema::table('approval_steps', fn (Blueprint $table) => $table->json('routing')->nullable());
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (DB::table('tenants')->whereNotNull('requisition_approval_policy')->exists() || DB::table('approval_steps')->whereNotNull('routing')->exists()) {
|
||||
throw new LogicException('Preserve os planos e níveis configurados antes de reverter a estrutura.');
|
||||
}
|
||||
Schema::table('approval_steps', fn (Blueprint $table) => $table->dropColumn('routing'));
|
||||
Schema::table('tenants', fn (Blueprint $table) => $table->dropColumn('requisition_approval_policy'));
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user