<?php

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

class AddNullableColumnsToRoutes extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('routes', function (Blueprint $table) {
            $table->integer('walking_distance')->nullable()->change();
            $table->integer('walking_duration')->nullable()->change();
            $table->integer('driving_distance')->nullable()->change();
            $table->integer('driving_duration')->nullable()->change();
            $table->integer('transit_distance')->nullable()->change();
            $table->integer('transit_duration')->nullable()->change();
            $table->boolean('allow_transports')->default(0)->change();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('qr_codes', function (Blueprint $table) {
            $table->dropUnique(['slug']);
        });
    }
}
