Completed
Pull Request — master (#546)
by Thomas
06:53
created

Version20161122085340   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 23
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 8 2
A down() 0 5 1
1
<?php
2
3
namespace OCA\activity\Migrations;
4
5
use Doctrine\DBAL\Migrations\AbstractMigration;
6
use Doctrine\DBAL\Schema\Schema;
7
use OC\DB\MDB2SchemaReader;
8
9
class Version20161122085340 extends AbstractMigration {
10
11
	/**
12
     * @param Schema $schema
13
     */
14
    public function up(Schema $schema) {
15
		$prefix = $this->connection->getPrefix();
16
		if ($schema->hasTable("{$prefix}activity")) {
17
			return;
18
		}
19
		$schemaReader = new MDB2SchemaReader(\OC::$server->getConfig(), $this->platform);
20
		$schemaReader->loadSchemaFromFile(__DIR__ . '/../database.xml', $schema);
21
    }
22
23
    /**
24
     * @param Schema $schema
25
     */
26
    public function down(Schema $schema) {
27
		$prefix = $this->connection->getPrefix();
28
		$schema->dropTable("{$prefix}activity");
29
		$schema->dropTable("{$prefix}activity_mq");
30
    }
31
}
32