<?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()
{
    Schema::table('customer_transactions', function (Blueprint $table) {
        $table->unsignedBigInteger('link_transaction_type_id')->nullable()->after('tax_type');
        $table->boolean('allow_sub_account_transactions')->default(false)->after('always_add_credit');
        $table->boolean('sales')->default(false)->after('allow_sub_account_transactions');
        $table->boolean('reconsile_control')->default(false)->after('sales');
        $table->boolean('credit_tax_account')->default(false)->after('reconsile_control');
        $table->boolean('net_control')->default(false)->after('credit_tax_account');
        $table->boolean('settlement_discount')->default(false)->after('net_control');
        $table->boolean('sales_transaction_type')->default(false)->after('settlement_discount');
        
        $table->foreign('link_transaction_type_id')
              ->references('id')
              ->on('customer_transactions');
    });
}

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('customer_transactions', function (Blueprint $table) {
            //
        });
    }
};
