Code Duplication    Length = 21-21 lines in 2 locations

apps/federatedfilesharing/appinfo/Migrations/Version20170804201253.php 1 location

@@ 10-30 (lines=21) @@
7
use OCP\Migration\ISchemaMigration;
8
9
/** Updates some fields to bigint if required */
10
class Version20170804201253 implements ISchemaMigration {
11
	public function changeSchema(Schema $schema, array $options) {
12
		$prefix = $options['tablePrefix'];
13
14
		if ($schema->hasTable("${prefix}federated_reshares")) {
15
			$table = $schema->getTable("{$prefix}federated_reshares");
16
17
			$shareIdColumn = $table->getColumn('share_id');
18
			if ($shareIdColumn && $shareIdColumn->getType()->getName() !== Type::BIGINT) {
19
				$shareIdColumn->setType(Type::getType(Type::BIGINT));
20
				$shareIdColumn->setOptions(['length' => 20]);
21
			}
22
23
			$remoteIdColumn = $table->getColumn('remote_id');
24
			if ($remoteIdColumn && $remoteIdColumn->getType()->getName() !== Type::BIGINT) {
25
				$remoteIdColumn->setType(Type::getType(Type::BIGINT));
26
				$remoteIdColumn->setOptions(['length' => 20]);
27
			}
28
		}
29
	}
30
}
31

apps/files_sharing/appinfo/Migrations/Version20170804201253.php 1 location

@@ 10-30 (lines=21) @@
7
use OCP\Migration\ISchemaMigration;
8
9
/** Updates some fields to bigint if required */
10
class Version20170804201253 implements ISchemaMigration {
11
	public function changeSchema(Schema $schema, array $options) {
12
		$prefix = $options['tablePrefix'];
13
14
		if ($schema->hasTable("${prefix}share_external")) {
15
			$table = $schema->getTable("{$prefix}share_external");
16
17
			$idColumn = $table->getColumn('id');
18
			if ($idColumn && $idColumn->getType()->getName() !== Type::BIGINT) {
19
				$idColumn->setType(Type::getType(Type::BIGINT));
20
				$idColumn->setOptions(['length' => 20]);
21
			}
22
23
			$remoteIdColumn = $table->getColumn('remote_id');
24
			if ($remoteIdColumn && $remoteIdColumn->getType()->getName() !== Type::BIGINT) {
25
				$remoteIdColumn->setType(Type::getType(Type::BIGINT));
26
				$remoteIdColumn->setOptions(['length' => 20]);
27
			}
28
		}
29
	}
30
}
31