36 lines
1.0 KiB
PHP
36 lines
1.0 KiB
PHP
<?php
|
|
|
|
use App\Enums\ChickenStatus;
|
|
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('chickens', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('tag_code', 20);
|
|
$table->date('hatch_date')->nullable();
|
|
$table->date('arrival_date');
|
|
$table->date('exit_date')->nullable();
|
|
$table->enum('status', ChickenStatus::cases())->default(ChickenStatus::ACTIVE->value)->comment(ChickenStatus::comment());
|
|
$table->timestamp('created_at')->useCurrent();
|
|
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
|
$table->softDeletes();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('chickens');
|
|
}
|
|
};
|