<?php

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

class AddColumnsToStockTables extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // Tambah kolom ke stocktransactions
        Schema::table('stocktransactions', function (Blueprint $table) {
            $table->boolean('is_pkp')->default(false)->after('pph21_amount');
        });

        // Tambah kolom ke substocktransactions
        Schema::table('substocktransactions', function (Blueprint $table) {
            $table->decimal('ppn_amount', 15, 2)->default(0)->after('original_purchase_price');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        // Rollback stocktransactions
        Schema::table('stocktransactions', function (Blueprint $table) {
            $table->dropColumn('is_pkp');
        });

        // Rollback substocktransactions
        Schema::table('substocktransactions', function (Blueprint $table) {
            $table->dropColumn('ppn_amount');
        });
    }
}
