Files
radicall/database/migrations/2025_09_11_214827_create_pets_table.php

39 lines
1.0 KiB
PHP

<?php
use App\Enums\PetGenderEnum;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('pets', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->string('type')->nullable();
$table->string('gender')->default(PetGenderEnum::Unknown->value);
$table->string('breed')->nullable();
$table->unsignedInteger('weight')->nullable();
$table->boolean('sterilized')->nullable();
$table->date('birthday')->nullable();
$table->timestamps();
$table->softDeletes();
$table->foreignId('owner_id')->constrained('users')->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('pets');
}
};