Completed
Pull Request — master (#14)
by Piotr
01:21
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
namespace OCA\files_paperhive\Migrations;
3
4
use Doctrine\DBAL\Schema\Schema;
5
use OCP\Migration\ISchemaMigration;
6
7
/**
8
 * Auto-generated migration step: Please modify to your needs!
9
 */
10
class Version20181006201617 implements ISchemaMigration {
11
12
	public function changeSchema(Schema $schema, array $options) {
13
		$prefix = $options['tablePrefix'];
14
		if (!$schema->hasTable("{$prefix}paperhive")) {
15
			$table = $schema->createTable("{$prefix}paperhive");
16
17
			$table->addColumn('fileid', 'integer', [
18
				'length' => 20,
19
				'notnull' => true,
20
				'unsigned' => true,
21
			]);
22
23
			$table->addColumn('bookid', 'string', [
24
				'length' => 64,
25
				'notnull' => true,
26
				'default' => ''
27
			]);
28
29
			$table->addIndex(
30
				['fileid'],
31
				'paperhive_fileid_index'
32
			);
33
		}
34
	}
35
}
36