]> BookStack Code Mirror - bookstack/blob - database/migrations/2020_08_04_111754_drop_joint_permissions_id.php
902d3c227b62fe32d7afa21619e54c3028fd869e
[bookstack] / database / migrations / 2020_08_04_111754_drop_joint_permissions_id.php
1 <?php
2
3 use Illuminate\Database\Migrations\Migration;
4 use Illuminate\Database\Schema\Blueprint;
5 use Illuminate\Support\Facades\Schema;
6
7 return new class extends Migration
8 {
9     /**
10      * Run the migrations.
11      *
12      * @return void
13      */
14     public function up()
15     {
16         Schema::table('joint_permissions', function (Blueprint $table) {
17             $table->dropColumn('id');
18             $table->primary(['role_id', 'entity_type', 'entity_id', 'action'], 'joint_primary');
19         });
20     }
21
22     /**
23      * Reverse the migrations.
24      *
25      * @return void
26      */
27     public function down()
28     {
29         Schema::table('joint_permissions', function (Blueprint $table) {
30             $table->dropPrimary(['role_id', 'entity_type', 'entity_id', 'action']);
31         });
32
33         Schema::table('joint_permissions', function (Blueprint $table) {
34             $table->increments('id')->unsigned();
35         });
36     }
37 };