Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
30 | public function upgrade(): void |
||
31 | { |
||
32 | $in_transaction = DB::connection()->getPdo()->inTransaction(); |
||
33 | |||
34 | if (DB::schema()->hasTable('maj_hooks')) { |
||
35 | DB::schema()->drop('maj_hooks'); |
||
36 | } |
||
37 | |||
38 | DB::schema()->create('maj_hook_order', static function (Blueprint $table): void { |
||
39 | $table->string('majho_module_name', 32); |
||
40 | $table->string('majho_hook_name', 64); |
||
41 | $table->integer('majho_hook_order')->nullable(); |
||
42 | |||
43 | $table->primary(['majho_module_name', 'majho_hook_name']); |
||
44 | }); |
||
45 | |||
46 | if ($in_transaction && !DB::connection()->getPdo()->inTransaction()) { |
||
47 | DB::connection()->beginTransaction(); |
||
48 | } |
||
51 |