Warenwirtschaft: OPT-1 Quick Wins + Entwicklungsplan V6.0

- N+1-Fix Ausschussliste: user.account eager laden (StockDisposalController@index)
- Composite-Indizes stock_entries(entry_type,status,ingredient_id/packaging_item_id) für InventoryService-Aggregationen
- Ungenutzten Eager-Load producedByUser aus ProductionRepository::listForIndex entfernt
- ExampleTest auf assertRedirect umgestellt (Suite 100% grün: 155 Tests)
- Query-Count-Regressionstest für die Ausschussliste
- Plan V6.0 (Code-Verifikation, OPT-Block, geklärte Kundenfragen)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-07-06 09:54:24 +00:00
parent e53201f229
commit 65f949dd7a
6 changed files with 240 additions and 5 deletions

View file

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Bestands-Aggregationen (InventoryService) filtern durchgängig auf
* (entry_type, status) und gruppieren nach ingredient_id bzw. packaging_item_id.
*/
public function up(): void
{
Schema::table('stock_entries', function (Blueprint $table) {
$table->index(['entry_type', 'status', 'ingredient_id'], 'stock_entries_type_status_ingredient_index');
$table->index(['entry_type', 'status', 'packaging_item_id'], 'stock_entries_type_status_packaging_index');
});
}
public function down(): void
{
Schema::table('stock_entries', function (Blueprint $table) {
$table->dropIndex('stock_entries_type_status_ingredient_index');
$table->dropIndex('stock_entries_type_status_packaging_index');
});
}
};