vernova/database/migrations/2024_01_01_000012_create_items_table.php
2026-07-26 19:58:27 +03:30

31 lines
828 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('items', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->constrained()->cascadeOnDelete();
$table->string('name');
$table->string('code')->nullable();
$table->string('unit', 30);
$table->string('category')->nullable();
$table->decimal('min_stock', 15, 2)->default(0);
$table->timestamps();
$table->index('tenant_id');
$table->index('code');
});
}
public function down(): void
{
Schema::dropIfExists('items');
}
};