Completed
Pull Request — master (#14)
by Piotr
01:20
created

Version20181006201617   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A changeSchema() 0 23 2
1
<?php
2
3
namespace OCA\Files_PaperHive\Migrations;
4
5
use Doctrine\DBAL\Schema\Schema;
6
use OCP\Migration\ISchemaMigration;
7
8
/**
9
 * Auto-generated migration step: Please modify to your needs!
10
 */
11
class Version20181006201617 implements ISchemaMigration {
12
13
	public function changeSchema(Schema $schema, array $options) {
14
		$prefix = $options['tablePrefix'];
15
		if (!$schema->hasTable("{$prefix}paperhive")) {
16
			$table = $schema->createTable("{$prefix}paperhive");
17
18
			$table->addColumn('fileid', 'integer', [
19
				'length' => 20,
20
				'notnull' => true,
21
				'unsigned' => true,
22
			]);
23
24
			$table->addColumn('bookid', 'string', [
25
				'length' => 64,
26
				'notnull' => true,
27
				'default' => ''
28
			]);
29
30
			$table->addIndex(
31
				['fileid'],
32
				'paperhive_fileid_index'
33
			);
34
		}
35
	}
36
}
37