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

28 lines
898 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('buildings', function (Blueprint $table) {
$table->id();
$table->foreignId('owner_id')->constrained('owners')->onDelete('cascade');
$table->string('building_name');
$table->text('address');
$table->string('city');
$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('buildings');
}
};