<?php

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

class AddIsReadColumnIntoContactsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::dropIfExists('contacts');

        Schema::create('contacts', function (Blueprint $table) {
            $table->id();
            $table->string('type')->nullable();
            $table->string('name')->nullable();
            $table->string('first_name');
            $table->string('last_name');
            $table->string('email');
            $table->string('phone_number');
            $table->text('content')->nullable();
            $table->string('company')->nullable();
            $table->string('zip_code_1')->nullable();
            $table->string('zip_code_2')->nullable();
            $table->text('prefectures')->nullable();
            $table->text('address')->nullable();
            $table->text('building_name')->nullable();
            $table->smallInteger('status')->default(0);
            $table->smallInteger('is_read')->default(0);
            $table->smallInteger('is_deleted')->default(0);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('contacts');

        Schema::create('contacts', function (Blueprint $table) {
            $table->id();
            $table->string('first_name');
            $table->string('last_name');
            $table->string('email');
            $table->string('phone_number');
            $table->string('content')->nullable();
            $table->smallInteger('status')->default(0);
            $table->timestamps();
        });
    }
}
