feat: add AnggotaKeluarga, RiwayatBantuan, PermohonanTransfer models and migrations

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
GuavaPopper
2026-06-05 04:52:23 +07:00
parent 9bd5506f4f
commit e907100175
11 changed files with 210 additions and 2 deletions
@@ -14,10 +14,15 @@ return new class extends Migration
Schema::create('rumah_ibadah', function (Blueprint $table) {
$table->id();
$table->string('nama');
$table->text('alamat');
$table->string('jenis')->nullable(); // masjid, gereja, pura, klenteng, vihara
$table->text('alamat')->nullable();
$table->decimal('latitude', 10, 8);
$table->decimal('longitude', 11, 8);
$table->integer('radius')->default(500);
$table->integer('jumlah_jemaah')->nullable();
$table->string('pengurus')->nullable();
$table->string('telepon')->nullable();
$table->text('keterangan')->nullable();
$table->timestamps();
});
}
@@ -13,11 +13,16 @@ return new class extends Migration
{
Schema::create('rumah_miskin', function (Blueprint $table) {
$table->string('id_rumah', 50)->primary();
$table->string('nama_kk')->nullable(); // Adding this as per SRS
$table->text('alamat')->nullable();
$table->integer('jumlah_kk')->default(1);
$table->integer('jumlah_orang')->default(1);
$table->decimal('latitude', 10, 8);
$table->decimal('longitude', 11, 8);
$table->string('pekerjaan')->nullable();
$table->bigInteger('pendapatan')->nullable();
$table->string('kondisi_rumah')->nullable(); // sangat_buruk, buruk, sedang
$table->text('keterangan')->nullable();
$table->timestamps();
});
}
@@ -0,0 +1,31 @@
<?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
{
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('sessions');
}
};
@@ -0,0 +1,28 @@
<?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('anggota_keluarga', function (Blueprint $table) {
$table->id();
$table->string('id_rumah', 50);
$table->foreign('id_rumah')->references('id_rumah')->on('rumah_miskin')->cascadeOnDelete();
$table->string('nama');
$table->enum('hubungan', ['kepala_keluarga', 'istri', 'anak', 'orang_tua', 'lainnya'])->default('lainnya');
$table->enum('jenis_kelamin', ['laki_laki', 'perempuan'])->nullable();
$table->date('tanggal_lahir')->nullable();
$table->enum('pendidikan', ['tidak_sekolah', 'sd', 'smp', 'sma', 'd3', 's1_plus'])->nullable();
$table->enum('status_hidup', ['hidup', 'meninggal'])->default('hidup');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('anggota_keluarga');
}
};
@@ -0,0 +1,27 @@
<?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('riwayat_bantuan', function (Blueprint $table) {
$table->id();
$table->string('id_rumah', 50);
$table->foreign('id_rumah')->references('id_rumah')->on('rumah_miskin')->cascadeOnDelete();
$table->foreignId('ibadah_id')->nullable()->constrained('rumah_ibadah')->nullOnDelete();
$table->foreignId('dicatat_oleh')->nullable()->constrained('users')->nullOnDelete();
$table->string('jenis_bantuan');
$table->text('keterangan')->nullable();
$table->date('tanggal_bantuan');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('riwayat_bantuan');
}
};
@@ -0,0 +1,29 @@
<?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('permohonan_transfer', function (Blueprint $table) {
$table->id();
$table->foreignId('dari_ibadah_id')->constrained('rumah_ibadah')->cascadeOnDelete();
$table->foreignId('ke_ibadah_id')->constrained('rumah_ibadah')->cascadeOnDelete();
$table->string('id_rumah', 50);
$table->foreign('id_rumah')->references('id_rumah')->on('rumah_miskin')->cascadeOnDelete();
$table->text('alasan');
$table->enum('status', ['pending', 'disetujui', 'ditolak'])->default('pending');
$table->text('catatan_respons')->nullable();
$table->foreignId('diajukan_oleh')->constrained('users')->cascadeOnDelete();
$table->foreignId('diproses_oleh')->nullable()->constrained('users')->nullOnDelete();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('permohonan_transfer');
}
};