27 lines
774 B
PHP
27 lines
774 B
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('batches', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('lot_number')->unique();
|
|
$table->foreignId('product_id')->constrained('products')->cascadeOnDelete();
|
|
$table->foreignId('recipe_id')->constrained('recipes')->cascadeOnDelete();
|
|
$table->date('produced_at')->nullable();
|
|
$table->date('expires_at')->nullable();
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('batches');
|
|
}
|
|
};
|