-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathFixVotes.php
More file actions
46 lines (39 loc) · 992 Bytes
/
FixVotes.php
File metadata and controls
46 lines (39 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2021 Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Polls\Migration;
use Doctrine\DBAL\Schema\Schema;
use OCA\Polls\Db\V7\TableManager;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
/**
* @psalm-suppress UnusedClass
*/
class FixVotes implements IRepairStep {
public function __construct(
private TableManager $tableManager,
private IDBConnection $connection,
private Schema $schema,
) {
}
/*
* @inheritdoc
*/
public function getName() {
return 'Polls repairstep - Fix votes with duration options';
}
/*
* @inheritdoc
*/
public function run(IOutput $output): void {
// secure, that the schema is updated to the current status
$this->schema = $this->connection->createSchema();
$this->tableManager->setSchema($this->schema);
$this->tableManager->fixVotes();
$this->connection->migrateToSchema($this->schema);
}
}