Revision::change()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 14
rs 9.8666
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DbMigrations;
6
7
use Phinx\Migration\AbstractMigration;
0 ignored issues
show
Bug introduced by
The type Phinx\Migration\AbstractMigration was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Phinx\Db\Adapter\MysqlAdapter;
0 ignored issues
show
Bug introduced by
The type Phinx\Db\Adapter\MysqlAdapter was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
final class Revision extends AbstractMigration
11
{
12
    public function change(): void
13
    {
14
        $modelTable = $this->table('revision', ['signed' => false, 'engine' => 'InnoDB', 'collation' => 'utf8mb4_unicode_ci']);
15
        $modelTable->addColumn('table_name', 'string', ['limit' => 255, 'null' => false, 'default' => ''])
16
            ->addColumn('original_id', 'integer', ['signed' => false, 'default' => 0])
17
            ->addColumn('title', 'string', ['limit' => 255, 'null' => false, 'default' => ''])
18
            ->addColumn('main_data', 'text', ['limit' => MysqlAdapter::TEXT_LONG])
19
            ->addColumn('i18n_data', 'text', ['limit' => MysqlAdapter::TEXT_LONG])
20
            ->addColumn('create_time', 'datetime')
21
            ->addColumn('update_time', 'datetime')
22
            ->addColumn('delete_time', 'datetime', ['null' => true])
23
            ->addColumn('status', 'boolean', ['default' => 1])
24
            ->addIndex(['table_name', 'original_id'])
25
            ->create();
26
    }
27
}
28