ConvertDatetimeToTimetamp   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 2

2 Methods

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