Completed
Pull Request — master (#23)
by Armando
13:41
created

UpdateSchema0541To0550   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 11 2
A down() 0 11 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
            return; // Migration may be partly done already...
20
        }
21
    }
22
23
    public function down(): void
24
    {
25
        try {
26
            Schema::table($this->prefix . 'message', static function (Blueprint $table) {
27
                $table->dropColumn('passport_data');
28
                $table->dropColumn('animation');
29
            });
30
        } catch (Throwable $e) {
31
            return; // Migration may be partly done already...
32
        }
33
    }
34
}
35