diff --git a/database/migrations/2021_08_08_125817_default_route.php b/database/migrations/2021_08_08_125817_default_route.php index f84119e..ee598a7 100644 --- a/database/migrations/2021_08_08_125817_default_route.php +++ b/database/migrations/2021_08_08_125817_default_route.php @@ -27,7 +27,7 @@ class DefaultRoute extends Migration */ public function down() { - DB::statement("DROP UNIQUE INDEX default_zone"); + DB::statement("DROP INDEX default_zone"); Schema::table('system_zone', function (Blueprint $table) { $table->dropColumn('default'); diff --git a/database/migrations/2021_08_15_134329_default_zones.php b/database/migrations/2021_08_15_134329_default_zones.php index 1d03a5a..a6d18f0 100644 --- a/database/migrations/2021_08_15_134329_default_zones.php +++ b/database/migrations/2021_08_15_134329_default_zones.php @@ -19,8 +19,9 @@ class DefaultZones extends Migration Schema::table('zones', function (Blueprint $table) { $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() { + DB::statement("DROP INDEX default_zones"); + Schema::table('zones', function (Blueprint $table) { - $table->dropUnique(['zone_id','default']); $table->dropColumn('default'); }); - Schema::table('zones', function (Blueprint $table) { + Schema::table('domains', function (Blueprint $table) { $table->boolean('default')->default(FALSE); }); }