-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathVersion20170808221437.php
More file actions
49 lines (44 loc) · 1.21 KB
/
Version20170808221437.php
File metadata and controls
49 lines (44 loc) · 1.21 KB
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
47
48
49
<?php
/**
* Files_antivirus
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Viktar Dubiniuk <dubiniuk@owncloud.com>
*
* @copyright Viktar Dubiniuk 2018
* @license AGPL-3.0
*/
namespace OCA\Files_Antivirus\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\BigIntType;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
use OCP\Migration\ISchemaMigration;
/**
* Updates some fields to bigint if required
*/
class Version20170808221437 implements ISchemaMigration {
/**
* @param Schema $schema
* @param array $options
*
* @return void
* @throws \Doctrine\DBAL\Exception
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function changeSchema(Schema $schema, array $options) {
$prefix = $options['tablePrefix'];
if ($schema->hasTable("{$prefix}files_antivirus")) {
$table = $schema->getTable("{$prefix}files_antivirus");
$fileIdColumn = $table->getColumn('fileid');
if ($fileIdColumn // @phpstan-ignore-line
&& $fileIdColumn->getType() instanceof BigIntType
) {
$fileIdColumn->setType(Type::getType(Types::BIGINT));
$fileIdColumn->setOptions(['length' => 20]);
}
}
}
}