35 lines
998 B
PHP
35 lines
998 B
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('slots', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('vending_machine_id')->constrained()->onDelete('cascade');
|
|
$table->string('slot_number'); // z.B. "10", "12", "14"
|
|
$table->string('position')->nullable(); // Position im Automaten (z.B. "A1", "B2")
|
|
$table->integer('capacity')->default(10); // Maximale Anzahl Produkte
|
|
$table->boolean('is_active')->default(true);
|
|
$table->timestamps();
|
|
|
|
$table->unique(['vending_machine_id', 'slot_number']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('slots');
|
|
}
|
|
};
|