Passed
Push — master ( d34270...7e8c5a )
by Marcel
04:09 queued 15s
created

Version4010Date20230815200000   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 8
c 1
b 1
f 0
dl 0
loc 25
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A changeSchema() 0 13 2
A __construct() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace OCA\Analytics\Migration;
6
7
use Closure;
8
use OCP\DB\ISchemaWrapper;
9
use OCP\Migration\IOutput;
10
use OCP\Migration\SimpleMigrationStep;
11
12
/**
13
 * Auto-generated migration step: Please modify to your needs!
14
 * sudo -u www-data php /var/www/nextcloud/occ migrations:execute analytics 4010Date20230815200000
15
 */
16
class Version4010Date20230815200000 extends SimpleMigrationStep
17
{
18
    public function __construct()
19
    {
20
    }
21
22
    /**
23
     * @param IOutput $output
24
     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
25
     * @param array $options
26
     * @return null|ISchemaWrapper
27
     */
28
    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options)
29
    {
30
        /** @var ISchemaWrapper $schema */
31
        $schema = $schemaClosure();
32
33
        $table = $schema->getTable('analytics_report');
34
        if (!$table->hasColumn('tableoptions')) {
35
            $table->addColumn('tableoptions', 'string', [
36
                'notnull' => false,
37
                'length' => 1000,
38
            ]);
39
        }
40
        return $schema;
41
    }
42
}