Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Version30717Date20210310164901.php « Migration « lib - github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8f4347f12d7f95fef2746e9c99b433aa95b0d07d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php

declare(strict_types=1);

namespace OCA\Richdocuments\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

class Version30717Date20210310164901 extends SimpleMigrationStep {

	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
		/** @var ISchemaWrapper $schema */
		$schema = $schemaClosure();

		$table = $schema->getTable('richdocuments_wopi');

		if (!$table->hasColumn('token_type')) {
			$table->addColumn('token_type', 'integer', [
				'notnull' => false,
				'length' => 4,
				'default' => 0,
			]);
		}
		if ($table->hasColumn('is_remote_token')) {
			$table->dropColumn('is_remote_token');
		}

		$table = $schema->getTable('richdocuments_direct');

		if (!$table->hasColumn('share')) {
			$table->addColumn('share', 'string', [
				'notnull' => false,
				'length' => 64
			]);
		}
		if (!$table->hasColumn('initiator_host')) {
			$table->addColumn('initiator_host', 'string', [
				'notnull' => false,
				'length' => 255
			]);
		}
		if (!$table->hasColumn('initiator_token')) {
			$table->addColumn('initiator_token', 'string', [
				'notnull' => false,
				'length' => 64
			]);
		}

		return $schema;
	}

}