1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
/** |
4
|
|
|
* @copyright Copyright (c) 2019 Morris Jobke <[email protected]> |
5
|
|
|
* |
6
|
|
|
* @author Morris Jobke <[email protected]> |
7
|
|
|
* |
8
|
|
|
* @license GNU AGPL version 3 or any later version |
9
|
|
|
* |
10
|
|
|
* This program is free software: you can redistribute it and/or modify |
11
|
|
|
* it under the terms of the GNU Affero General Public License as |
12
|
|
|
* published by the Free Software Foundation, either version 3 of the |
13
|
|
|
* License, or (at your option) any later version. |
14
|
|
|
* |
15
|
|
|
* This program is distributed in the hope that it will be useful, |
16
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18
|
|
|
* GNU Affero General Public License for more details. |
19
|
|
|
* |
20
|
|
|
* You should have received a copy of the GNU Affero General Public License |
21
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
22
|
|
|
* |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
|
26
|
|
|
namespace OC\Core\Migrations; |
27
|
|
|
|
28
|
|
|
use Closure; |
29
|
|
|
use Doctrine\DBAL\Types\Type; |
30
|
|
|
use OCP\DB\ISchemaWrapper; |
31
|
|
|
use OCP\Migration\SimpleMigrationStep; |
32
|
|
|
use OCP\Migration\IOutput; |
33
|
|
|
|
34
|
|
|
class Version17000Date20190514105811 extends SimpleMigrationStep { |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param IOutput $output |
38
|
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
39
|
|
|
* @param array $options |
40
|
|
|
* @return ISchemaWrapper |
41
|
|
|
*/ |
42
|
|
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
43
|
|
|
/** @var ISchemaWrapper $schema */ |
44
|
|
|
$schema = $schemaClosure(); |
45
|
|
|
if(!$schema->hasTable('filecache_extended')) { |
46
|
|
|
$table = $schema->createTable('filecache_extended'); |
47
|
|
|
$table->addColumn('fileid', Type::INTEGER, [ |
48
|
|
|
'notnull' => true, |
49
|
|
|
'length' => 4, |
50
|
|
|
'unsigned' => true, |
51
|
|
|
]); |
52
|
|
|
$table->addColumn('metadata_etag', Type::STRING, [ |
53
|
|
|
'notnull' => false, |
54
|
|
|
'length' => 40, |
55
|
|
|
]); |
56
|
|
|
$table->addColumn('creation_time', Type::BIGINT, [ |
57
|
|
|
'notnull' => true, |
58
|
|
|
'length' => 20, |
59
|
|
|
'default' => 0, |
60
|
|
|
]); |
61
|
|
|
$table->addColumn('upload_time', Type::BIGINT, [ |
62
|
|
|
'notnull' => true, |
63
|
|
|
'length' => 20, |
64
|
|
|
'default' => 0, |
65
|
|
|
]); |
66
|
|
|
$table->addUniqueIndex(['fileid'], 'fce_fileid_idx'); |
67
|
|
|
$table->addIndex(['creation_time'], 'fce_ctime_idx'); |
68
|
|
|
$table->addIndex(['upload_time'], 'fce_utime_idx'); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
return $schema; |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|