Completed
Pull Request — master (#23)
by Armando
15:35
created

UpdateSchema0541To0550   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 5
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

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