Passed
Push — master ( a463ab...0a1c26 )
by Marcel
08:12 queued 05:32
created

Version3006Date20210601200000::__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
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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\IDBConnection;
10
use OCP\Migration\IOutput;
11
use OCP\Migration\SimpleMigrationStep;
12
13
/**
14
 * Auto-generated migration step: Please modify to your needs!
15
 * sudo -u www-data php /var/www/nextcloud/occ migrations:execute analytics 3006Date20210601200000
16
 */
17
class Version3006Date20210601200000 extends SimpleMigrationStep
18
{
19
20
    /** @var IDBConnection */
21
    private $connection;
22
23
    public function __construct(IDBConnection $connection)
24
    {
25
        $this->connection = $connection;
26
    }
27
28
    /**
29
     * @param IOutput $output
30
     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
31
     * @param array $options
32
     */
33
    public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options)
34
    {
35
    }
36
37
    /**
38
     * @param IOutput $output
39
     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
40
     * @param array $options
41
     * @return null|ISchemaWrapper
42
     */
43
    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options)
44
    {
45
        /** @var ISchemaWrapper $schema */
46
        $schema = $schemaClosure();
47
48
        $table = $schema->getTable('analytics_share');
49
        if (!$table->hasColumn('parent')) {
50
            $table->addColumn('parent', 'integer', [
51
                'notnull' => false,
52
            ]);
53
        }
54
55
        $table = $schema->getTable('analytics_dataset');
56
        if (!$table->hasColumn('refresh')) {
57
            $table->addColumn('refresh', 'integer', [
58
                'notnull' => false,
59
            ]);
60
        }
61
62
        return $schema;
63
    }
64
65
    /**
66
     * @param IOutput $output
67
     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
68
     * @param array $options
69
     */
70
    public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options)
71
    {
72
73
    }
74
}
75