Completed
Pull Request — master (#23)
by Armando
10:28
created

UpdateSchema0541To0550   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
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\Schema;
7
use PhpTelegramBot\Laravel\Migration;
8
9
class UpdateSchema0541To0550 extends Migration
10
{
11
    public function up(): void
12
    {
13
        try {
14
            Schema::table($this->prefix . 'message', static function (Blueprint $table) {
15
                $table->text('animation')->nullable()->comment('Message is an animation, information about the animation')->after('document');
16
                $table->text('passport_data')->nullable()->comment('Telegram Passport data')->after('connected_website');
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('passport_data');
29
                $table->dropColumn('animation');
30
            });
31
        } catch (Throwable $e) {
32
            \Log::error($e->getMessage ());
33
            return; // Migration may be partly done already...
34
        }
35
    }
36
}
37