Completed
Push — stable10 ( 36ab92...0b967a )
by
unknown
22s
created

Version20170808221437   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 15
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A changeSchema() 0 13 4
1
<?php
2
3
namespace OCA\Files_Antivirus\Migrations;
4
5
use Doctrine\DBAL\Schema\Schema;
6
use Doctrine\DBAL\Types\Type;
7
use OCP\Migration\ISchemaMigration;
8
9
/** Updates some fields to bigint if required */
10
class Version20170808221437 implements ISchemaMigration {
11
	public function changeSchema(Schema $schema, array $options) {
12
		$prefix = $options['tablePrefix'];
13
14
		if ($schema->hasTable("${prefix}files_antivirus")) {
15
			$table = $schema->getTable("{$prefix}files_antivirus");
16
17
			$fileIdColumn = $table->getColumn('fileid');
18
			if ($fileIdColumn && $fileIdColumn->getType()->getName() !== Type::BIGINT) {
19
				$fileIdColumn->setType(Type::getType(Type::BIGINT));
20
				$fileIdColumn->setOptions(['length' => 20]);
21
			}
22
		}
23
	}
24
}
25