Issues (496)

lib/Migration/Version4013Date20240408180000.php (6 issues)

Labels
Severity
1
<?php
2
/**
3
 * Analytics
4
 *
5
 * SPDX-FileCopyrightText: 2019-2022 Marcel Scherello
6
 * SPDX-License-Identifier: AGPL-3.0-or-later
7
 */
8
9
declare(strict_types=1);
10
11
namespace OCA\Analytics\Migration;
12
13
use Closure;
14
use Doctrine\DBAL\Types\Type;
0 ignored issues
show
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...
15
use OCP\DB\ISchemaWrapper;
0 ignored issues
show
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...
16
use OCP\DB\Types;
0 ignored issues
show
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...
17
use OCP\IDBConnection;
0 ignored issues
show
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...
18
use OCP\Migration\IOutput;
0 ignored issues
show
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...
19
use OCP\Migration\SimpleMigrationStep;
0 ignored issues
show
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...
20
21
/**
22
 * Auto-generated migration step: Please modify to your needs!
23
 * sudo -u www-data php occ migrations:execute analytics 4013Date20240408180000
24
 */
25
class Version4013Date20240408180000 extends SimpleMigrationStep
26
{
27
28
    /** @var IDBConnection */
29
    private $connection;
30
31
    public function __construct(IDBConnection $connection)
32
    {
33
        $this->connection = $connection;
34
    }
35
36
    /**
37
     * @param IOutput $output
38
     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
39
     * @param array $options
40
     * @return null|ISchemaWrapper
41
     */
42
    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options)
43
    {
44
        /** @var ISchemaWrapper $schema */
45
        $schema = $schemaClosure();
46
47
        // Change Type of Description from string to text. Necessary due to length restrictions.
48
        $column = $schema->getTable('analytics_dataload')->getColumn('option');
49
        if ($column->getType() === Type::getType(Types::STRING)) {
50
            $column->setType(Type::getType(Types::TEXT));
51
        }
52
53
        return $schema;
54
    }
55
}