mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-04 00:44:41 +08:00
Dropped use of non-view joint permissions
This commit is contained in:
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropJointPermissionType extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::table('joint_permissions')
|
||||
->where('action', '!=', 'view')
|
||||
->delete();
|
||||
|
||||
Schema::table('joint_permissions', function (Blueprint $table) {
|
||||
$table->dropPrimary(['role_id', 'entity_type', 'entity_id', 'action']);
|
||||
$table->dropColumn('action');
|
||||
$table->primary(['role_id', 'entity_type', 'entity_id'], 'joint_primary');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('joint_permissions', function (Blueprint $table) {
|
||||
$table->string('action');
|
||||
$table->dropPrimary(['role_id', 'entity_type', 'entity_id']);
|
||||
$table->primary(['role_id', 'entity_type', 'entity_id', 'action']);
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user