Passed
Push — master ( d12bea...e67840 )
by Marcel
02:49
created

Version4009Date20230410190000   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 41
rs 10
c 1
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A changeSchema() 0 2 1
A postSchemaChange() 0 6 1
A __construct() 0 3 1
A preSchemaChange() 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\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 4009Date20230410190000
16
 */
17
class Version4009Date20230410190000 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
    }
46
47
    /**
48
     * @param IOutput $output
49
     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
50
     * @param array $options
51
     */
52
    public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options)
53
    {
54
        $query = $this->connection->getQueryBuilder();
55
        $query->delete('analytics_share')
56
            ->where($query->expr()->isNotNull('parent'))
57
            ->executeStatement();
58
    }
59
}
60