Record used material on tasks and suggest workflow steps' default materials

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-26 16:28:16 +02:00
co-authored by Claude Sonnet 5.5
parent 30132deb0e
commit bca1eed166
41 changed files with 1521 additions and 19 deletions
@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Default materials of workflow template steps (spec 19.4): suggested on
* the tasks made of the step, recorded only when confirmed. Also the
* suggestions waiting on such tasks, kept by the Inventory module.
*/
public function up(): void
{
Schema::create('workflow_template_step_materials', function (Blueprint $table) {
$table->id();
// Short constraint names: MySQL allows at most 64 characters.
$table->foreignId('workflow_template_step_id')->constrained(indexName: 'wtsm_step_foreign')->cascadeOnDelete();
$table->foreignId('stock_item_id')->constrained(indexName: 'wtsm_item_foreign')->restrictOnDelete();
$table->bigInteger('quantity_milli');
$table->unsignedInteger('sort_order');
$table->timestamps();
});
Schema::create('task_material_suggestions', function (Blueprint $table) {
$table->id();
$table->foreignId('task_id')->constrained()->cascadeOnDelete();
$table->foreignId('stock_item_id')->constrained()->restrictOnDelete();
$table->bigInteger('quantity_milli');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('task_material_suggestions');
Schema::dropIfExists('workflow_template_step_materials');
}
};