Files
compras/database/migrations/2026_10_28_000004_create_conflict_declarations.php
nala 4d42f083ce
tests / ci (push) Canceled after 0s
commit
2026-10-28 12:06:05 +02:00

32 lines
1.2 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('conflict_declarations', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->constrained()->restrictOnDelete();
$table->foreignId('user_id')->constrained()->restrictOnDelete();
$table->foreignId('supplier_id')->nullable()->constrained()->restrictOnDelete();
$table->foreignId('requisition_id')->nullable()->constrained()->restrictOnDelete();
$table->boolean('has_conflict');
$table->date('known_since');
$table->text('reason');
$table->timestamp('declared_at');
$table->foreignId('root_id')->nullable()->constrained('conflict_declarations')->restrictOnDelete();
$table->foreignId('previous_id')->nullable()->unique()->constrained('conflict_declarations')->restrictOnDelete();
$table->index(['tenant_id', 'user_id', 'has_conflict']);
});
}
public function down(): void
{
Schema::dropIfExists('conflict_declarations');
}
};