mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
Use table prefix in metadata migration
Signed-off-by: Louis Chemineau <louis@chmn.me>
This commit is contained in:
parent
0045e761fc
commit
dee1181e3b
2 changed files with 9 additions and 2 deletions
|
|
@ -29,6 +29,7 @@ use OCP\AppFramework\Utility\ITimeFactory;
|
|||
use OCP\BackgroundJob\IJobList;
|
||||
use OCP\BackgroundJob\TimedJob;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\IConfig;
|
||||
use OCP\IDBConnection;
|
||||
|
||||
// Migrate oc_file_metadata.metadata to oc_file_metadata.value.
|
||||
|
|
@ -40,6 +41,7 @@ class MetadataMigrationJob extends TimedJob {
|
|||
ITimeFactory $time,
|
||||
private IDBConnection $db,
|
||||
private IJobList $jobList,
|
||||
private IConfig $config,
|
||||
) {
|
||||
parent::__construct($time);
|
||||
|
||||
|
|
@ -48,7 +50,8 @@ class MetadataMigrationJob extends TimedJob {
|
|||
}
|
||||
|
||||
protected function run(mixed $argument): void {
|
||||
if (!$this->db->createSchema()->getTable('oc_file_metadata')->hasColumn('metadata')) {
|
||||
$prefix = $this->config->getSystemValueString('dbtableprefix', 'oc_');
|
||||
if (!$this->db->createSchema()->getTable($prefix.'file_metadata')->hasColumn('metadata')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ namespace OC\Repair;
|
|||
|
||||
use OC\Core\BackgroundJobs\MetadataMigrationJob;
|
||||
use OCP\BackgroundJob\IJobList;
|
||||
use OCP\IConfig;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\Migration\IOutput;
|
||||
use OCP\Migration\IRepairStep;
|
||||
|
|
@ -32,6 +33,7 @@ class AddMetadataMigrationJob implements IRepairStep {
|
|||
public function __construct(
|
||||
private IJobList $jobList,
|
||||
private IDBConnection $db,
|
||||
private IConfig $config,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +43,9 @@ class AddMetadataMigrationJob implements IRepairStep {
|
|||
|
||||
public function run(IOutput $output) {
|
||||
$schema = $this->db->createSchema();
|
||||
$metadataTable = $schema->getTable('oc_file_metadata');
|
||||
|
||||
$prefix = $this->config->getSystemValueString('dbtableprefix', 'oc_');
|
||||
$metadataTable = $schema->getTable($prefix.'file_metadata');
|
||||
|
||||
if (!$metadataTable->hasColumn('metadata')) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue