<?php

 

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    public function up(): void
    {
        Schema::create('balance_adjustments', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained()->onDelete('cascade');
            $table->foreignId('admin_id')->constrained('users')->onDelete('cascade');

            $table->enum('type', ['credit', 'debit']); // credit = add, debit = minus
            $table->integer('amount');                  // change amount
            $table->integer('before_balance');          // আগে কত ছিল
            $table->integer('after_balance');           // পরে কত হলো

            $table->string('reason')->nullable();       // note / কারণ
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('balance_adjustments');
    }
};
