fix migration for local

This commit is contained in:
jiasheng224
2024-04-22 18:41:04 +08:00
parent dcec8cb33b
commit 12710f614b
@@ -0,0 +1,65 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransactionType;
class CreateTransactionLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transaction_logs', function (Blueprint $table) {
$table->id();
$table->foreignId('transaction_id');
$table->morphs('owner');
$table->string('type')->default(TransactionType::PAYMENT);
$table->foreignId('issuer')->unsigned();
$table->foreignId('receiver')->unsigned();
$table->foreignId('recipient_bank_account_id')->unsigned();
$table->string('payment_method')->nullable();
$table->string('payment_reference')->nullable();
$table->string('bill_no')->unique();
$table->decimal('amount', 25, 5)->default(0.00);
$table->decimal('original_amount', 25, 5)->default(0.00);
$table->foreignId('currency_id')->unsigned();
$table->foreignId('original_currency_id')->unsigned();
$table->decimal('currency_rate', 14, 5)->default(0.00);
$table->decimal('tax', 14, 5)->default(0.00);
$table->decimal('service_charge', 14, 5)->default(0.00);
$table->timestamp('expires_on')->nullable();
$table->integer('status')->default(ApprovalStatus::PENDING_SUBMISSION);
$table->softDeletes();
$table->timestamps();
$table->foreign('transaction_id')->references('id')->on('transactions');
$table->foreign('currency_id')->references('id')->on('currencies');
$table->foreign('issuer')->references('id')->on('company_modules');
$table->foreign('receiver')->references('id')->on('company_modules');
$table->foreign('original_currency_id')->references('id')->on('currencies');
});
//In-case the model name lengthy
Schema::table('transaction_logs', function (Blueprint $table) {
$table->string('owner_type', 250)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transaction_logs');
}
}