32 lines
1.1 KiB
PHP
32 lines
1.1 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('warehouse_requests', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('tenant_id')->constrained()->restrictOnDelete();
|
|
$table->foreignId('created_by')->constrained('users')->restrictOnDelete();
|
|
$table->foreignId('warehouse_id')->constrained()->restrictOnDelete();
|
|
$table->foreignId('cost_center_id')->constrained()->restrictOnDelete();
|
|
$table->string('work_context_key')->default('procurement.internal');
|
|
$table->uuid('operation_key');
|
|
$table->string('input_hash', 64);
|
|
$table->string('status')->default('draft');
|
|
$table->json('snapshot');
|
|
$table->timestampTz('created_at');
|
|
$table->unique(['tenant_id', 'created_by', 'operation_key']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('warehouse_requests');
|
|
}
|
|
};
|