Files
ilycats/database/migrations/2026_02_01_122212_create_breeding_tables.php
T

64 lines
2.1 KiB
PHP
Raw Normal View History

2026-02-08 15:16:35 +07:00
<?php
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
{
// Tabel Utama Matting
Schema::create('mattings', function (Blueprint $table) {
$table->id();
$table->foreignId('sire_id')->constrained('cats');
$table->foreignId('dam_id')->constrained('cats');
// Pastikan nama kolom menggunakan awalan tgl_ dan akhiran _bapak/_ibu
$table->date('tgl_lahir_sire')->nullable();
$table->date('tgl_lahir_dam')->nullable();
$table->string('no_pedigree_bapak')->nullable(); // FIX
$table->string('no_pedigree_ibu')->nullable(); // FIX
$table->string('ems_bapak')->nullable(); // FIX
$table->string('ems_ibu')->nullable(); // FIX
$table->string('no_microchip_bapak')->nullable(); // FIX
$table->string('no_microchip_ibu')->nullable(); // FIX
$table->date('tgl_kawin_awal');
$table->date('tgl_kawin_akhir');
$table->integer('jumlah_anak_hidup')->default(0);
$table->timestamps();
});
// Tabel Detail Anak (Kittens)
Schema::create('kittens', function (Blueprint $table) {
$table->id();
$table->foreignId('matting_id')->constrained()->onDelete('cascade');
$table->date('tgl_lahir');
$table->string('nama');
$table->enum('jenis_kelamin', ['Jantan', 'Betina']);
$table->string('kode_ems')->nullable();
$table->string('no_microchip')->nullable();
$table->boolean('is_pedigree')->default(false);
$table->string('registry')->nullable(); // ICA, CFA, WCF, FFF
$table->string('foto_ped_1')->nullable();
$table->string('foto_ped_2')->nullable();
$table->string('foto_ped_3')->nullable();
$table->string('foto_ped_4')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
2026-09-23 12:45:02 +07:00
Schema::dropIfExists('kittens');
Schema::dropIfExists('mattings');
2026-02-08 15:16:35 +07:00
}
};