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

UpdateSchema0541To0550::up()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 0
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