<?php

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

class AddFieldsToAddressesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('addresses', function (Blueprint $table) {
            $table->string('title_contact_person')->after('last_name_contact_person')->nullable();
            $table->string('initials_contact_person')->after('title_contact_person')->nullable();
            $table->string('middle_name_contact_person')->after('initials_contact_person')->nullable();
            $table->string('job_title_contact_person')->after('middle_name_contact_person')->nullable();
            $table->string('house_number')->after('address')->nullable();
            $table->string('country')->after('city')->nullable();

            $table->string('title_representative')->after('country')->nullable();
            $table->string('initials_representative')->after('title_representative')->nullable();
            $table->string('first_name_representative')->after('initials_representative')->nullable();
            $table->string('middle_name_representative')->after('first_name_representative')->nullable();
            $table->string('last_name_representative')->after('middle_name_representative')->nullable();
            $table->string('email_representative')->after('last_name_representative')->nullable();
            $table->string('job_title_representative')->after('email_representative')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('addresses', function (Blueprint $table) {
            $table->dropColumn('title_contact_person');
            $table->dropColumn('initials_contact_person');
            $table->dropColumn('middle_name_contact_person');
            $table->dropColumn('job_title_contact_person');
            $table->dropColumn('house_number');
            $table->dropColumn('country');

            $table->dropColumn('title_representative');
            $table->dropColumn('initials_representative');
            $table->dropColumn('first_name_representative');
            $table->dropColumn('middle_name_representative');
            $table->dropColumn('last_name_representative');
            $table->dropColumn('email_representative');
            $table->dropColumn('job_title_representative');
        });
    }
}
