Files
real-estate/database/migrations/2026_01_10_000004_create_units_table.php
2026-01-11 17:11:43 +00:00

29 lines
971 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('units', function (Blueprint $table) {
$table->id();
$table->foreignId('building_id')->constrained('buildings')->onDelete('cascade');
$table->string('unit_no');
$table->string('floor_no')->nullable();
$table->integer('area_sqft')->nullable();
$table->json('assets')->nullable();
$table->string('status')->default('vacant');
$table->timestamps();
$table->foreignId('created_by')->nullable()->constrained('users');
$table->foreignId('updated_by')->nullable()->constrained('users');
$table->softDeletes();
});
}
public function down(): void
{
Schema::dropIfExists('units');
}
};