31 lines
828 B
PHP
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');
|
|
}
|
|
};
|