<?php

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

class DeleteSomeCcAndCpAddressesFieldsFromContactsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('contacts', function (Blueprint $table) {
            $table->dropColumn('address_cp');
            $table->dropColumn('house_number_cp');
            $table->dropColumn('postal_cp');
            $table->dropColumn('city_cp');
            
            $table->dropColumn('address_cc');
            $table->dropColumn('house_number_cc');
            $table->dropColumn('postal_cc');
            $table->dropColumn('city_cc');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('contacts', function (Blueprint $table) {
            $table->string('address_cp')->nullable();
            $table->string('house_number_cp')->after('mobile_cp')->nullable();
            $table->string('postal_cp')->nullable();
            $table->string('city_cp')->nullable();

            $table->string('address_cc')->nullable();
            $table->string('house_number_cc')->after('mobile_cc')->nullable();
            $table->string('postal_cc')->nullable();
            $table->string('city_cc')->nullable();
        });
    }
}
