Passed
Push — master ( 5468d0...b3b7b8 )
by Gabriel
14:40
created

TransactionsAmountField   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A change() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
use Phinx\Migration\AbstractMigration;
6
7
/**
8
 * Class TransactionsAmountField
9
 */
10
final class TransactionsAmountField extends AbstractMigration
11
{
12
    /**
13
     * Change Method.
14
     *
15
     * Write your reversible migrations using this method.
16
     *
17
     * More information on writing migrations is available here:
18
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
19
     *
20
     * Remember to call "create()" or "update()" and NOT "save()" when working
21
     * with the Table class.
22
     */
23
    public function change(): void
24
    {
25
        $table_name = \ByTIC\Payments\Utility\PaymentsModels::transactions()->getTable();
26
27
        $this->table($table_name)
28
            ->changeColumn('amount', 'int', ['null' => true, 'before' => 'currency'])
29
            ->save();
30
    }
31
}
32