Skip to content

Commit 03ad858

Browse files
authored
Merge pull request #14228 from nextcloud/feature/noid/add-metadata-etag
Add DB table to extend filecache with metadata etag, creation and upload time
2 parents a3deb21 + 60dcb18 commit 03ad858

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
}

lib/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,7 @@
757757
'OC\\Core\\Migrations\\Version16000Date20190212081545' => $baseDir . '/core/Migrations/Version16000Date20190212081545.php',
758758
'OC\\Core\\Migrations\\Version16000Date20190427105638' => $baseDir . '/core/Migrations/Version16000Date20190427105638.php',
759759
'OC\\Core\\Migrations\\Version16000Date20190428150708' => $baseDir . '/core/Migrations/Version16000Date20190428150708.php',
760+
'OC\\Core\\Migrations\\Version17000Date20190514105811' => $baseDir . '/core/Migrations/Version17000Date20190514105811.php',
760761
'OC\\Core\\Notification\\RemoveLinkSharesNotifier' => $baseDir . '/core/Notification/RemoveLinkSharesNotifier.php',
761762
'OC\\Core\\Service\\LoginFlowV2Service' => $baseDir . '/core/Service/LoginFlowV2Service.php',
762763
'OC\\DB\\Adapter' => $baseDir . '/lib/private/DB/Adapter.php',

lib/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
791791
'OC\\Core\\Migrations\\Version16000Date20190212081545' => __DIR__ . '/../../..' . '/core/Migrations/Version16000Date20190212081545.php',
792792
'OC\\Core\\Migrations\\Version16000Date20190427105638' => __DIR__ . '/../../..' . '/core/Migrations/Version16000Date20190427105638.php',
793793
'OC\\Core\\Migrations\\Version16000Date20190428150708' => __DIR__ . '/../../..' . '/core/Migrations/Version16000Date20190428150708.php',
794+
'OC\\Core\\Migrations\\Version17000Date20190514105811' => __DIR__ . '/../../..' . '/core/Migrations/Version17000Date20190514105811.php',
794795
'OC\\Core\\Notification\\RemoveLinkSharesNotifier' => __DIR__ . '/../../..' . '/core/Notification/RemoveLinkSharesNotifier.php',
795796
'OC\\Core\\Service\\LoginFlowV2Service' => __DIR__ . '/../../..' . '/core/Service/LoginFlowV2Service.php',
796797
'OC\\DB\\Adapter' => __DIR__ . '/../../..' . '/lib/private/DB/Adapter.php',

0 commit comments

Comments
 (0)