Passed
Push — master ( 5193bc...d3ccde )
by Marcel
02:52
created

Version3005Date20210516180000::postSchemaChange()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 12
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 3005Date20210516180000
16
 */
17
class Version3005Date20210516180000 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->insert('analytics_whats_new')
56
            ->values([
57
                'version' => $query->createNamedParameter('3.5.0'),
58
                'data' => $query->createNamedParameter('{"changelogURL":"https:\/\/github.com\/rello\/analytics\/blob\/master\/CHANGELOG.md","whatsNew":{
59
"en":{"regular":["More features behind the new chart menu (...)","First analysis function: trend lines in charts","Filter also for external data sources","Download charts"],"admin":["New Features apply to users"]},
60
"de":{"regular":["Mehr Funktionen hinter dem neuen Chartmenü (...)","Erste Analyse Funktion: Trendlinien in Diagrammen","Filter auch für externe Datenquellen","Charts herunterladen"],"admin":["Nur User Features"]}
61
}}'),
62
            ])
63
            ->execute();
64
    }
65
}
66