feat(webstatement): tambahkan migrasi tabel log laporan transaksi ATM
- Menambahkan file migrasi baru `create_atm_transaction_report_logs_table`:
- Membuat tabel `atm_transaction_report_logs` untuk menyimpan log laporan transaksi ATM.
- Struktur tabel meliputi:
- Field `period` (format Ymd) untuk menyimpan periode laporan.
- Status laporan `status` dengan opsi: `pending`, `processing`, `completed`, dan `failed`.
- Status otorisasi `authorization_status` dengan opsi: `pending`, `approved`, dan `rejected`.
- Informasi file laporan seperti `file_path`, `file_size`, dan `record_count`.
- Informasi kesalahan dengan `error_message`.
- Status unduhan laporan dengan `is_downloaded` dan `downloaded_at`.
- Informasi user terkait (`user_id`, `created_by`, `updated_by`, dan `authorized_by`).
- Metadata lain seperti `ip_address`, `user_agent`, serta timestamps.
- Menambahkan beberapa indeks untuk optimasi:
- Indeks untuk kolom `period`, `status`, `authorization_status`, dan `created_at`.
- Menambahkan fungsi rollback untuk menghapus tabel jika migrasi dibatalkan.
Signed-off-by: Daeng Deni Mardaeni <ddeni05@gmail.com>
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?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('atm_transaction_report_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('period', 8); // Format: Ymd (20250512)
|
||||
$table->date('report_date');
|
||||
$table->enum('status', ['pending', 'processing', 'completed', 'failed'])->default('pending');
|
||||
$table->enum('authorization_status', ['pending', 'approved', 'rejected'])->default('pending');
|
||||
$table->string('file_path')->nullable();
|
||||
$table->bigInteger('file_size')->nullable();
|
||||
$table->integer('record_count')->nullable();
|
||||
$table->text('error_message')->nullable();
|
||||
$table->boolean('is_downloaded')->default(false);
|
||||
$table->timestamp('downloaded_at')->nullable();
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->unsignedBigInteger('created_by');
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->unsignedBigInteger('authorized_by')->nullable();
|
||||
$table->timestamp('authorized_at')->nullable();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['period']);
|
||||
$table->index(['status']);
|
||||
$table->index(['authorization_status']);
|
||||
$table->index(['created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('atm_transaction_report_logs');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user