Passed
Push — master ( 192056...6c6baa )
by Marcel
05:20 queued 14s
created

Version4013Date20240408180000::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace OCA\Analytics\Migration;
6
7
use Closure;
8
use Doctrine\DBAL\Types\Type;
0 ignored issues
show
Bug introduced by
The type Doctrine\DBAL\Types\Type 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
use OCP\DB\ISchemaWrapper;
0 ignored issues
show
Bug introduced by
The type OCP\DB\ISchemaWrapper 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...
10
use OCP\DB\Types;
0 ignored issues
show
Bug introduced by
The type OCP\DB\Types 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...
11
use OCP\IDBConnection;
0 ignored issues
show
Bug introduced by
The type OCP\IDBConnection 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...
12
use OCP\Migration\IOutput;
0 ignored issues
show
Bug introduced by
The type OCP\Migration\IOutput 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...
13
use OCP\Migration\SimpleMigrationStep;
0 ignored issues
show
Bug introduced by
The type OCP\Migration\SimpleMigrationStep 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...
14
15
/**
16
 * Auto-generated migration step: Please modify to your needs!
17
 * sudo -u www-data php occ migrations:execute analytics 4013Date20240408180000
18
 */
19
class Version4013Date20240408180000 extends SimpleMigrationStep
20
{
21
22
    /** @var IDBConnection */
23
    private $connection;
24
25
    public function __construct(IDBConnection $connection)
26
    {
27
        $this->connection = $connection;
28
    }
29
30
    /**
31
     * @param IOutput $output
32
     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
33
     * @param array $options
34
     * @return null|ISchemaWrapper
35
     */
36
    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options)
37
    {
38
        /** @var ISchemaWrapper $schema */
39
        $schema = $schemaClosure();
40
41
        // Change Type of Description from string to text. Necessary due to length restrictions.
42
        $column = $schema->getTable('analytics_dataload')->getColumn('option');
43
        if ($column->getType() === Type::getType(Types::STRING)) {
44
            $column->setType(Type::getType(Types::TEXT));
45
        }
46
47
        return $schema;
48
    }
49
}