Completed
Push — master ( 721837...277496 )
by Victor
13:18
created

Version20170804201125::changeSchema()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 16
nc 2
nop 2
dl 0
loc 23
rs 9.0856
c 0
b 0
f 0
1
<?php
2
3
namespace OCA\FederatedFileSharing\Migrations;
4
use Doctrine\DBAL\Schema\Schema;
5
use OCP\Migration\ISchemaMigration;
6
7
/** Creates initial schema */
8
class Version20170804201125 implements ISchemaMigration {
9
	public function changeSchema(Schema $schema, array $options) {
10
		$prefix = $options['tablePrefix'];
11
		if (!$schema->hasTable("{$prefix}federated_reshares")) {
12
			$table = $schema->createTable("{$prefix}federated_reshares");
13
			$table->addColumn('share_id', 'bigint', [
14
				'unsigned' => false,
15
				'notnull' => true,
16
				'length' => 11,
17
			]);
18
19
			$table->addColumn('remote_id', 'bigint', [
20
				'unsigned' => false,
21
				'notnull' => true,
22
				'length' => 11,
23
				'comment' => 'share ID at the remote server'
24
			]);
25
26
			$table->addUniqueIndex(
27
				['share_id'],
28
				'share_id_index'
29
			);
30
		}
31
	}
32
}
33