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

Version20181006201617::changeSchema()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 9.552
c 0
b 0
f 0
cc 2
nc 2
nop 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