Default zone only when default=true
This commit is contained in:
parent
259ea01fd1
commit
e8df6f7103
@ -27,7 +27,7 @@ class DefaultRoute extends Migration
|
|||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
DB::statement("DROP UNIQUE INDEX default_zone");
|
DB::statement("DROP INDEX default_zone");
|
||||||
|
|
||||||
Schema::table('system_zone', function (Blueprint $table) {
|
Schema::table('system_zone', function (Blueprint $table) {
|
||||||
$table->dropColumn('default');
|
$table->dropColumn('default');
|
||||||
|
@ -19,8 +19,9 @@ class DefaultZones extends Migration
|
|||||||
|
|
||||||
Schema::table('zones', function (Blueprint $table) {
|
Schema::table('zones', function (Blueprint $table) {
|
||||||
$table->boolean('default')->default(FALSE);
|
$table->boolean('default')->default(FALSE);
|
||||||
$table->unique(['zone_id','default']);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
DB::statement('CREATE UNIQUE INDEX default_zones ON zones (zone_id) WHERE "default" = true');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,12 +31,13 @@ class DefaultZones extends Migration
|
|||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
|
DB::statement("DROP INDEX default_zones");
|
||||||
|
|
||||||
Schema::table('zones', function (Blueprint $table) {
|
Schema::table('zones', function (Blueprint $table) {
|
||||||
$table->dropUnique(['zone_id','default']);
|
|
||||||
$table->dropColumn('default');
|
$table->dropColumn('default');
|
||||||
});
|
});
|
||||||
|
|
||||||
Schema::table('zones', function (Blueprint $table) {
|
Schema::table('domains', function (Blueprint $table) {
|
||||||
$table->boolean('default')->default(FALSE);
|
$table->boolean('default')->default(FALSE);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user