Completed
Push — master ( 684518...9a4927 )
by Tom
45s
created

Version20170605143658   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A changeSchema() 0 15 2
1
<?php
2
namespace OC\Migrations;
3
4
use Doctrine\DBAL\Schema\Schema;
5
use OCP\Migration\ISchemaMigration;
6
7
/**
8
 * Updates the column lengths for the migrations table to reflect changes in its schema
9
 */
10
class Version20170605143658 implements ISchemaMigration {
11
12
	public function changeSchema(Schema $schema, array $options) {
13
		// Get the table
14
		$prefix = $options['tablePrefix'];
15
		$table = $schema->getTable("{$prefix}migrations");
16
17
		// Check column length to see if migration is necessary necessary
18
		if($table->getColumn('app')->getLength() === 177) {
19
			// then this server was installed after the fix
20
			return;
21
		}
22
23
		// Need to shorten columns
24
		$table->getColumn('app')->setLength(177);
25
		$table->getColumn('version')->setLength(14);
26
	}
27
}
28