<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class DefaultRoute extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('system_zone', function (Blueprint $table) { $table->boolean('default')->nullable(); }); DB::statement('CREATE UNIQUE INDEX default_zone ON system_zone (zone_id) WHERE "default" = true'); } /** * Reverse the migrations. * * @return void */ public function down() { DB::statement("DROP INDEX default_zone"); Schema::table('system_zone', function (Blueprint $table) { $table->dropColumn('default'); }); } }