feat: add migration and seeder databse lpj old to lpj new

This commit is contained in:
majid
2025-05-05 00:21:46 +07:00
parent 55036bf581
commit bf7e6275e3
54 changed files with 4355 additions and 85 deletions

View File

@@ -0,0 +1,52 @@
<?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::table('debitures', function (Blueprint $table) {
// nullable
$table->string('cif', 16)
->nullable()
->default('0000000000')
->comment('asal data LPJ.PRM_DEBITUR.KODE_CIF. Pada KODE_CIF ada yang digitnya 16 => 3372040405810002')
->change();
$table->unsignedBigInteger('branch_id')->nullable()->change();
$table->string('nomor_id', 50)->nullable()->change();
$table->unsignedBigInteger('mig_kd_debitur_seq')->nullable()->comment('asal data LPJ.PRM_DEBITUR.KD_DEBITUR_SEQ. Berguna untuk update debitur_id menggunakan KD_DEBITUR_SEQ nya');
$table->timestamp('processed_at')->nullable();
$table->char('is_mig', 1)->nullable()->comment('untuk menandakan row ini dari LPJ OLD');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('debitures', function (Blueprint $table) {
// Kembalikan kolom branch_id agar tidak nullable (asumsi awal NOT NULL)
$table->unsignedBigInteger('branch_id')->nullable(false)->change();
// Kembalikan kolom yang diubah nullable menjadi NOT NULL
$table->string('cif', 10)->nullable(false)->change();
$table->string('nomor_id', 50)->nullable(false)->change();
// Hapus kolom tambahan yang dibuat di up()
$table->dropColumn([
'mig_kd_debitur_seq',
'mig_urut_seq_addr',
'mig_urut_seq_comm',
'processed_at',
'is_mig'
]);
});
}
};

View File

@@ -0,0 +1,47 @@
<?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::table('permohonan', function (Blueprint $table) {
// nullable
$table->unsignedBigInteger('branch_id')->nullable()->change();
$table->unsignedBigInteger('user_id')->nullable()->change();
$table->unsignedBigInteger('mig_kd_debitur_seq')->nullable()->comment('asal data LPJ.PRM_DEBITUR.KD_DEBITUR_SEQ. Berguna untuk update debitur_id menggunakan KD_DEBITUR_SEQ nya');
$table->unsignedBigInteger('nomor_lpj')->nullable();
$table->timestamp('processed_at')->nullable();
$table->char('is_mig', 1)->nullable()->comment('untuk menandakan row ini dari LPJ OLD');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('permohonan', function (Blueprint $table) {
// Kembalikan kolom branch_id agar tidak nullable (asumsi awal NOT NULL)
$table->unsignedBigInteger('branch_id')->nullable(false)->change();
$table->unsignedBigInteger('user_id')->nullable(false)->change();
// Hapus kolom tambahan yang dibuat di up()
$table->dropColumn([
'mig_kd_debitur_seq',
'nomor_lpj',
'processed_at',
'is_mig'
]);
});
}
};

View File

@@ -0,0 +1,40 @@
<?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::table('dokumen_jaminan', function (Blueprint $table) {
// nullable
$table->unsignedBigInteger('mig_kd_debitur_seq')->nullable()->comment('asal data LPJ.PRM_DEBITUR.KD_DEBITUR_SEQ. Berguna untuk update debitur_id menggunakan KD_DEBITUR_SEQ nya');
$table->unsignedBigInteger('nomor_lpj')->nullable();
$table->timestamp('processed_at')->nullable();
$table->char('is_mig', 1)->nullable()->comment('untuk menandakan row ini dari LPJ OLD');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('dokumen_jaminan', function (Blueprint $table) {
// Hapus kolom tambahan yang dibuat di up()
$table->dropColumn([
'nomor_lpj',
'mig_kd_debitur_seq',
'processed_at',
'is_mig'
]);
});
}
};

View File

@@ -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 {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('pemilik_jaminan', function (Blueprint $table) {
// nullable
$table->unsignedBigInteger('mig_kd_debitur_seq')->nullable()->comment('asal data LPJ.PRM_DEBITUR.KD_DEBITUR_SEQ. Berguna untuk update debitur_id menggunakan KD_DEBITUR_SEQ nya');
$table->timestamp('processed_at')->nullable();
$table->char('is_mig', 1)->nullable()->comment('untuk menandakan row ini dari LPJ OLD');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('pemilik_jaminan', function (Blueprint $table) {
// Hapus kolom tambahan yang dibuat di up()
$table->dropColumn([
'mig_kd_debitur_seq',
'processed_at',
'is_mig'
]);
});
}
};

View File

@@ -0,0 +1,32 @@
<?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::table('inspeksi', function (Blueprint $table) {
$table->unsignedBigInteger('nomor_lpj')->nullable();
$table->timestamp('processed_at')->nullable();
$table->char('is_mig', 1)->nullable()->comment('untuk menandakan row ini dari LPJ OLD');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('inspeksi', function (Blueprint $table) {
$table->dropColumn('nomor_lpj');
$table->dropColumn('processed_at');
$table->dropColumn('is_mig');
});
}
};

View File

@@ -0,0 +1,33 @@
<?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::table('penilai', function (Blueprint $table) {
$table->unsignedBigInteger('nomor_lpj')->nullable();
$table->timestamp('processed_at')->nullable();
$table->char('is_mig', 1)->nullable()->comment('untuk menandakan row ini dari LPJ OLD');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('penilai', function (Blueprint $table) {
$table->dropColumn('nomor_lpj');
$table->dropColumn('processed_at');
$table->dropColumn('is_mig');
});
}
};