UpdateSchema0541To0550::down()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 7
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 10
rs 10
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 UpdateSchema0541To0550 extends Migration
11
{
12
    public function up(): void
13
    {
14
        try {
15
            Schema::table($this->prefix . 'message', static function (Blueprint $table) {
16
                $table->text('animation')->nullable()->comment('Message is an animation, information about the animation')->after('document');
17
                $table->text('passport_data')->nullable()->comment('Telegram Passport data')->after('connected_website');
18
            });
19
        } catch (Throwable $e) {
20
            Log::error($e->getMessage());
21
            return; // Migration may be partly done already...
22
        }
23
    }
24
25
    public function down(): void
26
    {
27
        try {
28
            Schema::table($this->prefix . 'message', static function (Blueprint $table) {
29
                $table->dropColumn('passport_data');
30
                $table->dropColumn('animation');
31
            });
32
        } catch (Throwable $e) {
33
            Log::error($e->getMessage());
34
            return; // Migration may be partly done already...
35
        }
36
    }
37
}
38