<?php

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

class AddMobileTelAndSleeve extends Migration
{
    public function up()
    {
        Schema::table('delivery_addresses', function (Blueprint $table) {
            if (!Schema::hasColumn('delivery_addresses', 'mobile_tel')) {
                $table->string('mobile_tel')->nullable()->after('phone_number')->comment('携帯番号（注文ごと）');
            }
        });

        Schema::table('order_details', function (Blueprint $table) {
            if (!Schema::hasColumn('order_details', 'sleeve')) {
                $table->string('sleeve', 10)->nullable()->after('foot')->comment('裄丈（注文ごと）');
            }
        });
    }

    public function down()
    {
        Schema::table('delivery_addresses', function (Blueprint $table) {
            $table->dropColumn('mobile_tel');
        });
        Schema::table('order_details', function (Blueprint $table) {
            $table->dropColumn('sleeve');
        });
    }
}
