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

TransactionsAmountField::change()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 7
rs 10
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