Add SQL query for migrating branch data from prm_cabang table
- Created a new SQL file `query_mig_branches.sql` to select and format branch data. - The query retrieves various fields including branch code, name, status, and contact information. - Data is trimmed to remove any leading or trailing whitespace. - Results are ordered by branch code for consistency.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?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('branches', function (Blueprint $table) {
|
||||
$table->string('code', 11)->change(); // Ubah panjang VARCHAR pada SYSLOGIN KD_CABANG varchar2(11)
|
||||
$table->text('mig_alamat')->nullable()->comment('asal data SYSLOGIN.PRM_CABANG.ALAMAT');
|
||||
$table->string('mig_fax', 50)->nullable()->comment('asal data SYSLOGIN.PRM_CABANG.FAX');
|
||||
$table->char('mig_flag_data', 1)->nullable()->comment('asal data SYSLOGIN.PRM_CABANG.FLAG_DATA, Berguna untuk update branches.status');
|
||||
$table->char('mig_flag_oto', 1)->nullable()->comment('asal data SYSLOGIN.PRM_CABANG.FLAG_OTO');
|
||||
$table->char('mig_kode_level', 1)->nullable()->comment('asal data SYSLOGIN.PRM_CABANG.KODE_LEVEL');
|
||||
$table->char('mig_kode_status', 1)->nullable()->comment('asal data SYSLOGIN.PRM_CABANG.KODE_STATUS');
|
||||
$table->string('mig_kodepos', 5)->nullable()->comment('asal data SYSLOGIN.PRM_CABANG.KODEPOS');
|
||||
$table->string('mig_kota', 50)->nullable()->comment('asal data SYSLOGIN.PRM_CABANG.KOTA');
|
||||
$table->string('mig_telepon', 100)->nullable()->comment('asal data SYSLOGIN.PRM_CABANG.TELEPON');
|
||||
$table->dateTime('mig_tgl_oto')->nullable()->comment('asal data SYSLOGIN.PRM_CABANG.TGL_OTO');
|
||||
$table->dateTime('mig_tgl_update')->nullable()->comment('asal data SYSLOGIN.PRM_CABANG.TGL_UPDATE. Berguna untuk update branches.updated_at');
|
||||
$table->string('mig_user_oto', 10)->nullable()->comment('asal data SYSLOGIN.PRM_CABANG.USER_OTO');
|
||||
$table->string('mig_user_update', 10)->nullable()->comment('asal data SYSLOGIN.PRM_CABANG.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('branches', function (Blueprint $table) {
|
||||
|
||||
$table->string('code', 9)->change();
|
||||
$table->dropColumn([
|
||||
'mig_alamat',
|
||||
'mig_fax',
|
||||
'mig_flag_data',
|
||||
'mig_flag_oto',
|
||||
'mig_kode_level',
|
||||
'mig_kode_status',
|
||||
'mig_kodepos',
|
||||
'mig_kota',
|
||||
'mig_telepon',
|
||||
'mig_tgl_oto',
|
||||
'mig_tgl_update',
|
||||
'mig_user_oto',
|
||||
'mig_user_update',
|
||||
'is_mig'
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user