32 lines
1.2 KiB
PHP
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');
|
|
}
|
|
};
|