Add SQL seeders and queries for mig_debitures
- Created `mig_debitures_comms.sql` to insert communication records for debtors. - Added `query_mig_debiturs.sql` to retrieve debtor information with address and communication details. - Introduced `query_mig_debiturs_addrs.sql` to fetch unique addresses for debtors. - Implemented `query_mig_debiturs_comms.sql` to select unique communication records for debtors.
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
<?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->unsignedBigInteger('branch_id')->nullable()->change();
|
||||
$table->string('cif', 16)->nullable()->comment('asal data LPJ.PRM_DEBITUR.KODE_CIF. Pada KODE_CIF ada yang digitnya 16 => 3372040405810002')->change();
|
||||
$table->string('nomor_id', 50)->nullable()->change();
|
||||
|
||||
// Menambahkan kolom baru dengan nullable dan comment
|
||||
$table->char('mig_addr_display', 1)->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.ADDR_DISPLAY');
|
||||
$table->char('mig_comm_display', 1)->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.COMM_DISPLAY');
|
||||
$table->char('mig_flag_oto', 1)->nullable()->comment('asal data LPJ.PRM_DEBITUR.FLAG_OTO');
|
||||
$table->string('mig_kd_cabang', 11)->nullable()->comment('asal data LPJ.PRM_DEBITUR.KD_CABANG. Berguna untuk update branch_id');
|
||||
$table->string('mig_kd_cabang_addr', 11)->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.KD_CABANG');
|
||||
$table->string('mig_kd_cabang_comm', 11)->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.KD_CABANG');
|
||||
$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->string('mig_nama_daerah', 200)->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.NAMA_DAERAH');
|
||||
$table->string('mig_no_cif', 20)->nullable()->comment('asal data LPJ.PRM_DEBITUR.NO_CIF');
|
||||
$table->string('mig_nomor_id2', 50)->nullable()->comment('asal data LPJ.PRM_DEBITUR.NO_ID. dipisahkan karena isinya tidak murni number');
|
||||
$table->string('mig_phone', 300)->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.COMM_VALUE. dipisahkan karena isinya tidak murni number phone');
|
||||
$table->dateTime('mig_tgl_oto')->nullable()->comment('asal data LPJ.PRM_DEBITUR.TGL_OTO');
|
||||
$table->unsignedBigInteger('mig_urut_seq_addr')->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.URUT_SEQ');
|
||||
$table->unsignedBigInteger('mig_urut_seq_comm')->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.URUT_SEQ');
|
||||
$table->string('mig_user_oto', 10)->nullable()->comment('asal data LPJ.PRM_DEBITUR.USER_OTO');
|
||||
$table->string('mig_user_update')->nullable()->comment('asal data LPJ.PRM_DEBITUR.USER_UPDATE');
|
||||
$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_addr_display',
|
||||
'mig_comm_display',
|
||||
'mig_flag_oto',
|
||||
'mig_kd_cabang',
|
||||
'mig_kd_cabang_addr',
|
||||
'mig_kd_cabang_comm',
|
||||
'mig_kd_debitur_seq',
|
||||
'mig_nama_daerah',
|
||||
'mig_no_cif',
|
||||
'mig_nomor_id2',
|
||||
'mig_phone',
|
||||
'mig_tgl_oto',
|
||||
'mig_urut_seq_addr',
|
||||
'mig_urut_seq_comm',
|
||||
'mig_user_oto',
|
||||
'mig_user_update',
|
||||
'is_mig'
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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::create('mig_debitures_addrs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('mig_kd_debitur_seq')->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.KD_DEBITUR_SEQ');
|
||||
$table->unsignedBigInteger('mig_urut_seq')->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.URUT_SEQ');
|
||||
$table->unsignedBigInteger('mig_addr_type_seq')->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.ADDR_TYPE_SEQ');
|
||||
$table->string('mig_addr_value', 500)->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.ADDR_VALUE');
|
||||
$table->string('mig_user_update', 10)->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.USER_UPDATE');
|
||||
$table->dateTime('mig_tgl_update')->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.TGL_UPDATE');
|
||||
$table->char('mig_flag_oto', 1)->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.FLAG_OTO');
|
||||
$table->string('mig_user_oto', 10)->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.USER_OTO');
|
||||
$table->dateTime('mig_tgl_oto')->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.TGL_OTO');
|
||||
$table->unsignedBigInteger('mig_kd_kel_seq')->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.KD_KEL_SEQ');
|
||||
$table->char('mig_addr_display', 1)->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.ADDR_DISPLAY');
|
||||
$table->string('mig_kd_cabang', 11)->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.KD_CABANG');
|
||||
$table->string('mig_nama_daerah', 200)->nullable()->comment('asal data LPJ.PRM_DEBITUR_ADDR.NAMA_DAERAH');
|
||||
$table->char('is_mig', 1)->nullable()->comment('untuk menandakan row ini dari LPJ OLD');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('mig_debitures_addrs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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('mig_debitures_comms', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('mig_kd_debitur_seq')->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.KD_DEBITUR_SEQ');
|
||||
$table->unsignedBigInteger('mig_urut_seq')->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.URUT_SEQ');
|
||||
$table->unsignedBigInteger('mig_comm_type_seq')->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.COMM_TYPE_SEQ');
|
||||
$table->string('mig_comm_value', 300)->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.COMM_VALUE');
|
||||
$table->unsignedBigInteger('mig_addr_type_seq')->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.ADDR_TYPE_SEQ');
|
||||
$table->string('mig_user_update', 10)->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.USER_UPDATE');
|
||||
$table->dateTime('mig_tgl_update')->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.TGL_UPDATE');
|
||||
$table->char('mig_flag_oto', 1)->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.FLAG_OTO');
|
||||
$table->string('mig_user_oto', 10)->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.USER_OTO');
|
||||
$table->dateTime('mig_tgl_oto')->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.TGL_OTO');
|
||||
$table->char('mig_comm_display', 1)->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.ADDR_DISPLAY');
|
||||
$table->string('mig_kd_cabang', 11)->nullable()->comment('asal data LPJ.PRM_DEBITUR_COMM.KD_CABANG');
|
||||
$table->char('is_mig', 1)->nullable()->comment('untuk menandakan row ini dari LPJ OLD');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('mig_debitures_comms');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user