UpdateSchema0530To0540   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 9 2
A down() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
use Illuminate\Database\Schema\Blueprint;
6
use Illuminate\Support\Facades\Log;
7
use Illuminate\Support\Facades\Schema;
8
use PhpTelegramBot\Laravel\Migration;
9
10
class UpdateSchema0530To0540 extends Migration
11
{
12
    public function up(): void
13
    {
14
        try {
15
            Schema::table($this->prefix . 'message', static function (Blueprint $table) {
16
                $table->text('game')->nullable()->comment('Message is a game, information about the game.')->after('document');
17
            });
18
        } catch (Throwable $e) {
19
            Log::error($e->getMessage());
20
            return; // Migration may be partly done already...
21
        }
22
    }
23
24
    public function down(): void
25
    {
26
        try {
27
            Schema::table($this->prefix . 'message', static function (Blueprint $table) {
28
                $table->dropColumn('game');
29
            });
30
        } catch (Throwable $e) {
31
            Log::error($e->getMessage());
32
            return; // Migration may be partly done already...
33
        }
34
    }
35
}
36