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

Version30704Date20200626072306.php « Migration « lib - github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5094f3f4cb9607b43bc0c7cb33a3881442512fe1 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php

declare(strict_types=1);

namespace OCA\Richdocuments\Migration;

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

class Version30704Date20200626072306 extends SimpleMigrationStep {

	/**
	 * @param IOutput $output
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
	 * @param array $options
	 * @return null|ISchemaWrapper
	 */
	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
		/** @var ISchemaWrapper $schema */
		$schema = $schemaClosure();

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

		if (!$table->hasColumn('template_id')) {
			$table->addColumn('template_id', 'integer', [
				'notnull' => false,
				'length' => 4,
			]);
		}

		if (!$table->hasColumn('hide_download')) {
			$table->addColumn('hide_download', 'boolean', [
				'notnull' => true,
				'default' => false,
			]);
		}

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

		if (!$table->hasColumn('direct')) {
			$table->addColumn('direct', 'boolean', [
				'notnull' => true,
				'default' => false,
			]);
		}
		if (!$table->hasColumn('is_remote_token')) {
			$table->addColumn('is_remote_token', 'boolean', [
				'notnull' => true,
				'default' => false,
			]);
		}

		if (!$table->hasColumn('remote_server')) {
			$table->addColumn('remote_server', 'string', [
				'notnull' => true,
				'default' => '',
			]);

		}
		if (!$table->hasColumn('remote_server_token')) {
			$table->addColumn('remote_server_token', 'string', [
				'notnull' => true,
				'length' => 32,
				'default' => '',
			]);
		}


		return $schema;
	}
}