64 lines
2.1 KiB
PHP
64 lines
2.1 KiB
PHP
<?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
|
|
{
|
|
Schema::dropIfExists('kittens');
|
|
Schema::dropIfExists('mattings');
|
|
}
|
|
};
|