clrghouz/database/migrations/2021_08_08_125817_default_route.php
2021-08-09 23:35:22 +10:00

37 lines
762 B
PHP

<?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 UNIQUE INDEX default_zone");
Schema::table('system_zone', function (Blueprint $table) {
$table->dropColumn('default');
});
}
}