Completed
Pull Request — master (#546)
by Thomas
03:29
created

Version20161122085340::up()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 8
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
crap 6
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