Passed
Push — master ( fde606...0af3c0 )
by Armando
08:21
created

ConvertDatetimeToTimetamp::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
use PhpTelegramBot\Laravel\Migration;
6
7
class ConvertDatetimeToTimetamp extends Migration
8
{
9
    /** @var array[] Fields that require DATETIME to TIMESTAMP conversion. */
10
    private $tableColumns = [
11
        'callback_query'       => ['created_at'],
12
        'chosen_inline_result' => ['created_at'],
13
        'edited_message'       => ['edit_date'],
14
        'inline_query'         => ['created_at'],
15
        'message'              => ['date', 'forward_date'],
16
        'request_limiter'      => ['created_at'],
17
    ];
18
19
    public function up(): void
20
    {
21
        $this->changeColumnTypes($this->tableColumns, 'TIMESTAMP NULL DEFAULT NULL');
22
    }
23
24
    public function down(): void
25
    {
26
        $this->changeColumnTypes($this->tableColumns, 'DATETIME NULL DEFAULT NULL');
27
    }
28
}
29