Completed
Pull Request — master (#546)
by Thomas
36:55
created

Version20161122092159   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 14
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A changeSchema() 0 16 3
1
<?php
2
3
namespace OCA\activity\Migrations;
4
5
use Doctrine\DBAL\Platforms\OraclePlatform;
6
use Doctrine\DBAL\Schema\Schema;
7
use Doctrine\DBAL\Types\Type;
8
use OCP\Migration\ISchemaMigration;
9
10
class Version20161122092159 implements ISchemaMigration {
11
12
	/**
13
	 * @param Schema $schema
14
	 * @param array $options
15
	 */
16
	public function changeSchema(Schema $schema, array $options) {
17
		$prefix = $options['tablePrefix'];
18
		$tableName = "{$prefix}activity";
19
		$table = $schema->getTable($tableName);
20
		// we only apply this step if the columns is not yet a CLOB
21
		if ($table->getColumn('subjectparams')->getType() === Type::getType(Type::TEXT)) {
22
			return;
23
		}
24
25
		if (\OC::$server->getDatabaseConnection()->getDatabasePlatform() instanceof OraclePlatform) {
0 ignored issues
show
Bug introduced by
The class Doctrine\DBAL\Platforms\OraclePlatform does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
26
			return;
27
		}
28
		$table = $schema->getTable($tableName);
29
		$table->changeColumn('subjectparams', ['type' => Type::getType('text')]);
30
		$table->changeColumn('messageparams', ['type' => Type::getType('text')]);
31
    }
32
}
33