UpdateSchema0541To0550   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 10 2
A up() 0 10 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 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