<?php

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

class AddTinToCompaniesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('companies', function (Blueprint $table) {
            $table->string('tin')->nullable()->after('debtor');
            $table->string('msic_code')->nullable()->after('debtor')->comment("5-digit code representing business activity");
            $table->timestamp('e_invoice_requested_at')->nullable()->after('debtor');
            $table->boolean('e_invoice')->nullable()->default(null)->after('debtor');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('companies', function (Blueprint $table) {
            $table->dropColumn('tin');
            $table->dropColumn('msic_code');
            $table->dropColumn('e_invoice_requested_at');
            $table->dropColumn('e_invoice');
        });
    }
}
