Version0_17_1::up()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 9
nc 2
nop 1
dl 0
loc 12
rs 9.9666
c 1
b 0
f 0
1
<?php
2
3
namespace App\Migration;
4
5
use Doctrine\DBAL\Schema\Schema;
0 ignored issues
show
Bug introduced by
The type Doctrine\DBAL\Schema\Schema 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...
6
use Doctrine\Migrations\AbstractMigration;
0 ignored issues
show
Bug introduced by
The type Doctrine\Migrations\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...
7
8
/**
9
 * Class Version0_17_1
10
 */
11
final class Version0_17_1 extends AbstractMigration
12
{
13
    /**
14
     * Up migration
15
     *
16
     * @param \Doctrine\DBAL\Schema\Schema $schema
17
     */
18
    public function up(Schema $schema)
19
    {
20
        switch ($this->platform->getName()) {
21
            case 'postgresql':
22
                $this->addSql('ALTER TABLE app_page_trans ADD presentation TEXT DEFAULT NULL');
23
                $this->addSql('ALTER TABLE app_page_trans ADD data JSON NOT NULL DEFAULT \'{}\'');
24
                $this->addSql('COMMENT ON COLUMN app_page_trans.data IS \'(DC2Type:json_array)\'');
25
                break;
26
27
            default:
28
                $this->abortIf(true,'Migration cannot be executed on "'.$this->platform->getName().'".');
29
                break;
30
        }
31
    }
32
33
    /**
34
     * Down migration
35
     *
36
     * @param \Doctrine\DBAL\Schema\Schema $schema
37
     */
38
    public function down(Schema $schema)
39
    {
40
        switch ($this->platform->getName()) {
41
            case 'postgresql':
42
                $this->addSql('ALTER TABLE app_page_trans DROP presentation');
43
                $this->addSql('ALTER TABLE app_page_trans DROP data');
44
                break;
45
46
            default:
47
                $this->abortIf(true,'Migration cannot be executed on "'.$this->platform->getName().'".');
48
                break;
49
        }
50
    }
51
}
52