<?php

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

use App\Models\Currency;

class CurrencyAddRounding extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('ab_currency', function (Blueprint $table) {
            $table->smallInteger('rounding');
        });

	Currency::query()->update(['rounding'=>2]);
    }

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