This commit is contained in:
2026-11-02 20:27:11 +02:00
parent b44378b899
commit badaada043
300 changed files with 17458 additions and 1056 deletions
@@ -35,6 +35,6 @@ return new class extends Migration
public function down(): void
{
Schema::dropIfExists('warehouse_reservations');
throw new LogicException('Preservar o histórico de reservas e entregas.');
}
};
@@ -0,0 +1,35 @@
<?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('replenishment_work', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->constrained()->restrictOnDelete();
$table->foreignId('stock_item_id')->constrained()->restrictOnDelete();
$table->foreignId('warehouse_id')->constrained()->restrictOnDelete();
$table->foreignId('responsible_id')->constrained('users')->restrictOnDelete();
$table->unsignedBigInteger('generation')->default(1);
$table->unsignedBigInteger('processed_generation')->default(0);
$table->unsignedInteger('attempts')->default(0);
$table->unsignedInteger('failures')->default(0);
$table->string('last_outcome')->nullable();
$table->text('last_error')->nullable();
$table->timestampTz('due_at');
$table->timestampTz('last_run_at')->nullable();
$table->timestampsTz();
$table->unique(['tenant_id', 'stock_item_id', 'warehouse_id']);
$table->index(['due_at', 'id']);
});
}
public function down(): void
{
throw new LogicException('Preservar trabalhos de reposição pendentes e histórico de recuperação.');
}
};