2021-08-09 13:35:22 +00:00
|
|
|
<?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()
|
|
|
|
{
|
2021-08-17 14:13:25 +00:00
|
|
|
DB::statement("DROP INDEX default_zone");
|
2021-08-09 13:35:22 +00:00
|
|
|
|
|
|
|
Schema::table('system_zone', function (Blueprint $table) {
|
|
|
|
$table->dropColumn('default');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|