Passed
Push — master ( e1d9e3...479464 )
by Marcel
03:19 queued 15s
created

Version4001Date20220317190000::postSchemaChange()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
nc 1
nop 3
dl 0
loc 2
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 OCP\DB\ISchemaWrapper;
9
use OCP\IDBConnection;
10
use OCP\DB\QueryBuilder\IQueryBuilder;
11
use OCP\Migration\IOutput;
12
use OCP\Migration\SimpleMigrationStep;
13
14
/**
15
 * Auto-generated migration step: Please modify to your needs!
16
 * sudo -u www-data php /var/www/nextcloud/occ migrations:execute analytics 3007Date20211003180000
17
 *
18
 * Deletions
19
 * dataset:
20
 * subheader, link, visual, chart*, *options, parent, type
21
 */
22
class Version4001Date20220317190000 extends SimpleMigrationStep
23
{
24
25
    /** @var IDBConnection */
26
    private $connection;
27
28
    public function __construct(IDBConnection $connection)
29
    {
30
        $this->connection = $connection;
31
    }
32
33
    /**
34
     * @param IOutput $output
35
     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
36
     * @param array $options
37
     */
38
    public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options)
39
    {
40
    }
41
42
    /**
43
     * @param IOutput $output
44
     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
45
     * @param array $options
46
     * @return null|ISchemaWrapper
47
     */
48
    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options)
49
    {
50
        /** @var ISchemaWrapper $schema */
51
        $schema = $schemaClosure();
52
53
        $table = $schema->getTable('analytics_share');
54
        if (!$table->hasColumn('domain')) {
55
            $table->addColumn('domain', 'string', [
56
                'notnull' => false,
57
                'length' => 256,
58
            ]);
59
        }
60
        return $schema;
61
    }
62
63
    /**
64
     * @param IOutput $output
65
     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
66
     * @param array $options
67
     */
68
    public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options)
69
    {
70
    }
71
}