Total Complexity | 4 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
6 | class ModifyRolesAndPermissionsTableOptimizeIndexes extends BaseMigration |
||
7 | { |
||
8 | public function up() |
||
12 | } |
||
13 | |||
14 | public function down() |
||
15 | { |
||
16 | $this->revertIndexes($this->user_role, 'user_id'); |
||
17 | $this->revertIndexes($this->role_permission, 'role_id'); |
||
18 | } |
||
19 | |||
20 | protected function optimizeIndexes(string $table, string $first_key) |
||
21 | { |
||
22 | $this->table($table, function (Blueprint $table) use ($first_key) { |
||
23 | $table->index([$first_key]); |
||
24 | }); |
||
25 | } |
||
26 | |||
27 | protected function revertIndexes(string $table, string $first_key) |
||
31 | }); |
||
32 | } |
||
33 | } |
||
34 |