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

30 lines
840 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('warehouses', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->constrained()->cascadeOnDelete();
$table->foreignId('project_id')->nullable()->constrained()->nullOnDelete();
$table->string('name');
$table->string('location')->nullable();
$table->boolean('is_active')->default(true);
$table->timestamps();
$table->index('tenant_id');
$table->index('project_id');
});
}
public function down(): void
{
Schema::dropIfExists('warehouses');
}
};