Compare commits

...

2 Commits

Author SHA1 Message Date
daengdeni
2e2c8b4b0d refactor(database): remove id from account_balances table
- Menghapus kolom `id` dari tabel `account_balances` termasuk primary key auto-increment-nya.
- Menjadikan kolom `account_number` dan `period` sebagai composite primary key.
- Menghapus constraint unik pada kolom `account_number` dan `period`.
- Menambahkan kembali kolom `id` dan constraint unik pada proses rollback.
- Memastikan mendukung migrasi maju dan mundur dengan aman.
2025-05-24 08:27:35 +07:00
daengdeni
e3b6e46d83 ```
refactor(jobs): update file extension and sanitize transaction reference

- Mengubah konstanta `FILE_EXTENSION` pada `ProcessAtmTransactionJob` dari `.ST.ATM.csv` menjadi `.ST.ATM.TRANSACTION.csv`.
- Menambahkan logika pembersihan pada `trans_reference` dalam `ProcessStmtEntryDataJob`:
  - Menghapus string `\BNK` jika ada dalam field `trans_reference`.
- Mempertahankan fungsionalitas utama untuk memastikan kompatibilitas data dan pengolahan job tetap berjalan sesuai dengan kebutuhan.
```
2025-05-24 08:27:03 +07:00
3 changed files with 48 additions and 1 deletions

View File

@@ -19,7 +19,7 @@
private const PARAMETER_FOLDER = '_parameter';
// Konstanta untuk nilai-nilai statis
private const FILE_EXTENSION = '.ST.ATM.csv';
private const FILE_EXTENSION = '.ST.ATM.TRANSACTION.csv';
private const CSV_DELIMITER = '~';
private const DISK_NAME = 'sftpStatement';
private const HEADER_MAP = [

View File

@@ -78,6 +78,11 @@
$data = array_combine($headers, $row);
try {
if ($data['stmt_entry_id'] !== 'stmt_entry_id') {
// Bersihkan trans_reference dari \\BNK jika ada
if (isset($data['trans_reference'])) {
$data['trans_reference'] = str_replace('\\BNK', '', $data['trans_reference']);
}
StmtEntry::updateOrCreate(
['stmt_entry_id' => $data['stmt_entry_id']],
$data

View File

@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('account_balances', function (Blueprint $table) {
// First drop the unique constraint since we'll be making these columns the primary key
$table->dropUnique(['account_number', 'period']);
// Drop the id column and its auto-increment primary key
$table->dropColumn('id');
// Set the composite primary key
$table->primary(['account_number', 'period']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('account_balances', function (Blueprint $table) {
// Drop the composite primary key
$table->dropPrimary(['account_number', 'period']);
// Add back the id column with auto-increment
$table->id()->first();
// Re-add the unique constraint
$table->unique(['account_number', 'period']);
});
}
};