This commit is contained in:
2026-08-03 09:22:47 +07:00
17 changed files with 1414 additions and 238 deletions
@@ -0,0 +1,38 @@
<?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('bumdes_pengurus', function (Blueprint $table) {
$table->id();
$table->string('uid')->unique();
$table->string('nama');
$table->boolean('jenis_kelamin');
$table->string('tempat_lahir')->nullable();
$table->date('tanggal_lahir');
$table->string('pendidikan_terakhir')->nullable();
$table->text('alamat')->nullable();
$table->foreignId('desa_kelurahan_id')->nullable()->constrained('master_desa_kelurahan')->onDelete('set null');
$table->string('nomor_telepon')->nullable();
$table->string('jabatan');
$table->string('jabatan_lainnya')->nullable();
$table->unsignedSmallInteger('lama_menjabat_tahun')->nullable();
$table->date('tanggal_mulai_menjabat');
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
$table->timestamps();
$table->softDeletes();
});
}
public function down(): void
{
Schema::dropIfExists('bumdes_pengurus');
}
};
@@ -0,0 +1,42 @@
<?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::table('bumdes_pengurus', function (Blueprint $table) {
if (! Schema::hasColumn('bumdes_pengurus', 'pendidikan_terakhir')) {
$table->string('pendidikan_terakhir')->nullable()->after('tanggal_lahir');
}
if (! Schema::hasColumn('bumdes_pengurus', 'jabatan_lainnya')) {
$table->string('jabatan_lainnya')->nullable()->after('jabatan');
}
if (! Schema::hasColumn('bumdes_pengurus', 'lama_menjabat_tahun')) {
$table->unsignedSmallInteger('lama_menjabat_tahun')->nullable()->after('jabatan_lainnya');
}
});
}
public function down(): void
{
Schema::table('bumdes_pengurus', function (Blueprint $table) {
if (Schema::hasColumn('bumdes_pengurus', 'lama_menjabat_tahun')) {
$table->dropColumn('lama_menjabat_tahun');
}
if (Schema::hasColumn('bumdes_pengurus', 'jabatan_lainnya')) {
$table->dropColumn('jabatan_lainnya');
}
if (Schema::hasColumn('bumdes_pengurus', 'pendidikan_terakhir')) {
$table->dropColumn('pendidikan_terakhir');
}
});
}
};