<?php

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

class AddRefundFieldsOrderItems extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('order_items', function (Blueprint $table) {
            $table->decimal('invoice_quantity', 15, 2)->default(0);
            $table->decimal('invoice_total', 15, 2)->default(0);
            $table->decimal('refunded_quantity', 15, 2)->default(0);
            $table->decimal('refunded_total', 15, 2)->default(0);
            $table->decimal('quantity_to_fulfill', 15, 2)->default(0);
            $table->decimal('fulfilled_quantity', 15, 2)->default(0);
            $table->decimal('quantity_to_refund', 15, 2)->default(0);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('order_items', function (Blueprint $table) {
            $table->dropColumn('invoice_quantity');
            $table->dropColumn('invoice_total');
            $table->dropColumn('refunded_quantity');
            $table->dropColumn('refunded_total');
            $table->dropColumn('quantity_to_fulfill');
            $table->dropColumn('quantity_to_refund');
            $table->dropColumn('fulfilled_quantity');
        });
    }
}
