Skip to content

Commit

Permalink
fix(dav): increase length of propertypath column
Browse files Browse the repository at this point in the history
Match it to the value in oc_filecache table path column should be fine.

Closes #9907

Signed-off-by: Thomas Citharel <[email protected]>
  • Loading branch information
tcitworld committed Jul 2, 2023
1 parent 855b8e3 commit b592d60
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/dav/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
'OCA\\DAV\\Migration\\Version1028Date20230630091518' => $baseDir . '/../lib/Migration/Version1028Date20230630091518.php',
'OCA\\DAV\\Migration\\Version1028Date20230702074215' => $baseDir . '/../lib/Migration/Version1028Date20230702074215.php',
'OCA\\DAV\\Migration\\Version1028Date20230702074341' => $baseDir . '/../lib/Migration/Version1028Date20230702074341.php',
'OCA\\DAV\\Migration\\Version1028Date20230702074342' => $baseDir . '/../lib/Migration/Version1028Date20230702074342.php',
'OCA\\DAV\\Profiler\\ProfilerPlugin' => $baseDir . '/../lib/Profiler/ProfilerPlugin.php',
'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningNode' => $baseDir . '/../lib/Provisioning/Apple/AppleProvisioningNode.php',
'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningPlugin' => $baseDir . '/../lib/Provisioning/Apple/AppleProvisioningPlugin.php',
Expand Down
1 change: 1 addition & 0 deletions apps/dav/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ class ComposerStaticInitDAV
'OCA\\DAV\\Migration\\Version1028Date20230630091518' => __DIR__ . '/..' . '/../lib/Migration/Version1028Date20230630091518.php',
'OCA\\DAV\\Migration\\Version1028Date20230702074215' => __DIR__ . '/..' . '/../lib/Migration/Version1028Date20230702074215.php',
'OCA\\DAV\\Migration\\Version1028Date20230702074341' => __DIR__ . '/..' . '/../lib/Migration/Version1028Date20230702074341.php',
'OCA\\DAV\\Migration\\Version1028Date20230702074342' => __DIR__ . '/..' . '/../lib/Migration/Version1028Date20230702074342.php',
'OCA\\DAV\\Profiler\\ProfilerPlugin' => __DIR__ . '/..' . '/../lib/Profiler/ProfilerPlugin.php',
'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningNode' => __DIR__ . '/..' . '/../lib/Provisioning/Apple/AppleProvisioningNode.php',
'OCA\\DAV\\Provisioning\\Apple\\AppleProvisioningPlugin' => __DIR__ . '/..' . '/../lib/Provisioning/Apple/AppleProvisioningPlugin.php',
Expand Down
78 changes: 78 additions & 0 deletions apps/dav/lib/Migration/Version1028Date20230702074342.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

declare(strict_types=1);

/**
* @copyright Copyright (c) 2023 Your name <[email protected]>
*
* @author Your name <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCA\DAV\Migration;

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

/**
* Auto-generated migration step: Please modify to your needs!
*/
class Version1028Date20230702074342 extends SimpleMigrationStep {

/**
* @param IOutput $output
* @param Closure(): ISchemaWrapper $schemaClosure
* @param array $options
*/
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
}

/**
* @param IOutput $output
* @param Closure(): ISchemaWrapper $schemaClosure
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
$propertiesTable = $schema->getTable('properties');

// Indexes can't be added on columns with such length, so we drop them here before recreating them
$propertiesTable->dropIndex('properties_path_index');
$propertiesTable->dropIndex('properties_pathonly_index');

$propertyValueColumn = $propertiesTable->getColumn('propertypath');
$propertyValueColumn->setLength(4000);

$propertiesTable->addIndex(['userid', 'propertypath'], 'properties_path_idx_prefix', [], ['lengths' => [null, 64]]);
$propertiesTable->addIndex(['propertypath'], 'properties_pathonly_idx_prefix', [], ['lengths' => [64]]);

return $schema;
}

/**
* @param IOutput $output
* @param Closure(): ISchemaWrapper $schemaClosure
* @param array $options
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
}
}

0 comments on commit b592d60

Please sign in to comment.