Skip to content

Commit

Permalink
Add unique index to collectionGroup handle (#1779)
Browse files Browse the repository at this point in the history
  • Loading branch information
wychoong authored Jun 6, 2024
1 parent cf6fd8f commit 298a8c4
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/core/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ php artisan migrate

Lunar currently provides bug fixes and security updates for only the latest minor release, e.g. `0.7`.

## 1.0.0-alpha.x

### High Impact

#### Unique index for Collection Group handle

Collection Group now have unique index on the column `handle`.
If you are creating Collection Group from the admin panel, there is no changes required.

## 1.0.0-alpha.20

### High Impact
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Lunar\Base\Migration;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table($this->prefix . 'collection_groups', function (Blueprint $table) {
$table->dropIndex(['handle']);
});

Schema::table($this->prefix . 'collection_groups', function (Blueprint $table) {
$table->unique(['handle']);
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table($this->prefix . 'collection_groups', function (Blueprint $table) {
$table->dropUnique(['handle']);
});

Schema::table($this->prefix . 'collection_groups', function (Blueprint $table) {
$table->index(['handle']);
});
}
};

0 comments on commit 298a8c4

Please sign in to comment.