Completed
Push — stable10 ( 36ab92...0b967a )
by
unknown
22s
created

Version20170808220321   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 68
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A changeSchema() 0 66 3
1
<?php
2
3
namespace OCA\Files_Antivirus\Migrations;
4
use Doctrine\DBAL\Schema\Schema;
5
use OCP\Migration\ISchemaMigration;
6
7
/** Creates initial schema */
8
class Version20170808220321 implements ISchemaMigration {
9
	public function changeSchema(Schema $schema, array $options) {
10
		$prefix = $options['tablePrefix'];
11
		if (!$schema->hasTable("{$prefix}files_antivirus")) {
12
			$table = $schema->createTable("{$prefix}files_antivirus");
13
			$table->addColumn('fileid', 'bigint', [
14
				'unsigned' => true,
15
				'notnull' => true,
16
				'length' => 11,
17
			]);
18
19
			$table->addColumn('check_time', 'integer', [
20
				'notnull' => true,
21
				'unsigned' => true,
22
				'default' => 0,
23
			]);
24
			$table->setPrimaryKey(['fileid']);
25
		}
26
27
		if (!$schema->hasTable("{$prefix}files_avir_status")) {
28
			$table = $schema->createTable("{$prefix}files_avir_status");
29
			$table->addColumn('id', 'integer', [
30
				'autoincrement' => true,
31
				'unsigned' => true,
32
				'notnull' => true,
33
				'length' => 11,
34
			]);
35
36
			$table->addColumn('group_id', 'integer', [
37
				'notnull' => true,
38
				'unsigned' => true,
39
				'default' => 0,
40
			]);
41
42
			$table->addColumn('status_type', 'integer', [
43
				'notnull' => true,
44
				'unsigned' => true,
45
				'default' => 0,
46
			]);
47
48
			$table->addColumn('result', 'integer', [
49
				'notnull' => true,
50
				'unsigned' => false,
51
				'default' => 0,
52
			]);
53
54
			$table->addColumn('match', 'string', [
55
				'length' => 64,
56
				'notnull' => false,
57
				'default' => null,
58
			]);
59
60
			$table->addColumn('description', 'string', [
61
				'length' => 64,
62
				'notnull' => false,
63
				'default' => null,
64
			]);
65
66
			$table->addColumn('status', 'integer', [
67
				'length' => 4,
68
				'notnull' => true,
69
				'default' => 0,
70
				'unsigned' => false,
71
			]);
72
			$table->setPrimaryKey(['id']);
73
		}
74
	}
75
}
76