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

Version20170804201125   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A changeSchema() 0 62 2
1
<?php
2
3
namespace OCA\Files_Trashbin\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}files_trash")) {
12
			$table = $schema->createTable("{$prefix}files_trash");
13
			$table->addColumn('auto_id', 'bigint', [
14
				'autoincrement' => true,
15
				'unsigned' => false,
16
				'notnull' => true,
17
				'length' => 11,
18
			]);
19
20
			$table->addColumn('id', 'string', [
21
				'length' => 250,
22
				'notnull' => true,
23
				'default' => ''
24
			]);
25
26
			$table->addColumn('user', 'string', [
27
				'length' => 64,
28
				'notnull' => true,
29
				'default' => ''
30
			]);
31
32
			$table->addColumn('timestamp', 'string', [
33
				'length' => 12,
34
				'notnull' => true,
35
				'default' => ''
36
			]);
37
38
			$table->addColumn('location', 'string', [
39
				'length' => 512,
40
				'notnull' => true,
41
				'default' => ''
42
			]);
43
44
			$table->addColumn('type', 'string', [
45
				'length' => 4,
46
				'notnull' => false,
47
				'default' => null
48
			]);
49
50
			$table->addColumn('mime', 'string', [
51
				'length' => 255,
52
				'notnull' => false,
53
				'default' => null
54
			]);
55
56
			$table->setPrimaryKey(['auto_id']);
57
			$table->addIndex(
58
				['id'],
59
				'id_index'
60
			);
61
			$table->addIndex(
62
				['timestamp'],
63
				'timestamp_index'
64
			);
65
			$table->addIndex(
66
				['user'],
67
				'user_index'
68
			);
69
		}
70
	}
71
}
72