mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-04 08:54:33 +08:00
Removed joint_permissions auto_increment id
Removed auto_incrementing id and set a primary key of the [role_id, entity_type, entity_id, action] instead since this table could recieve a lot of activity, especially when permission regeneration was automated, leading to very high auto_increment counts which could max out the integer limit. Also updated some RolesTest comment endpoints to align with recent route changes. Should fix #2091
This commit is contained in:
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropJointPermissionsId extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('joint_permissions', function (Blueprint $table) {
|
||||
$table->dropColumn('id');
|
||||
$table->primary(['role_id', 'entity_type', 'entity_id', 'action'], 'joint_primary');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('joint_permissions', function (Blueprint $table) {
|
||||
$table->dropPrimary(['role_id', 'entity_type', 'entity_id', 'action']);
|
||||
});
|
||||
|
||||
Schema::table('joint_permissions', function (Blueprint $table) {
|
||||
$table->increments('id')->unsigned();
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user