mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
Comment legacy file_metadata table migrations
Signed-off-by: Louis Chemineau <louis@chmn.me>
This commit is contained in:
parent
4a9f99809c
commit
e621396139
3 changed files with 47 additions and 46 deletions
|
|
@ -40,26 +40,26 @@ class Version24000Date20220404230027 extends SimpleMigrationStep {
|
|||
* @return null|ISchemaWrapper
|
||||
*/
|
||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
// /** @var ISchemaWrapper $schema */
|
||||
// $schema = $schemaClosure();
|
||||
|
||||
if (!$schema->hasTable('file_metadata')) {
|
||||
$table = $schema->createTable('file_metadata');
|
||||
$table->addColumn('id', Types::BIGINT, [
|
||||
'notnull' => true,
|
||||
]);
|
||||
$table->addColumn('group_name', Types::STRING, [
|
||||
'notnull' => true,
|
||||
'length' => 50,
|
||||
]);
|
||||
$table->addColumn('value', Types::TEXT, [
|
||||
'notnull' => false,
|
||||
'default' => '',
|
||||
]);
|
||||
$table->setPrimaryKey(['id', 'group_name'], 'file_metadata_idx');
|
||||
// if (!$schema->hasTable('file_metadata')) {
|
||||
// $table = $schema->createTable('file_metadata');
|
||||
// $table->addColumn('id', Types::BIGINT, [
|
||||
// 'notnull' => true,
|
||||
// ]);
|
||||
// $table->addColumn('group_name', Types::STRING, [
|
||||
// 'notnull' => true,
|
||||
// 'length' => 50,
|
||||
// ]);
|
||||
// $table->addColumn('value', Types::TEXT, [
|
||||
// 'notnull' => false,
|
||||
// 'default' => '',
|
||||
// ]);
|
||||
// $table->setPrimaryKey(['id', 'group_name'], 'file_metadata_idx');
|
||||
|
||||
return $schema;
|
||||
}
|
||||
// return $schema;
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,19 +50,20 @@ class Version27000Date20230309104325 extends SimpleMigrationStep {
|
|||
* @return null|ISchemaWrapper
|
||||
*/
|
||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
$metadataTable = $schema->getTable('file_metadata');
|
||||
// /** @var ISchemaWrapper $schema */
|
||||
// $schema = $schemaClosure();
|
||||
// $metadataTable = $schema->getTable('file_metadata');
|
||||
|
||||
if ($metadataTable->hasColumn('value')) {
|
||||
return null;
|
||||
}
|
||||
// if ($metadataTable->hasColumn('value')) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
$metadataTable->addColumn('value', Types::TEXT, [
|
||||
'notnull' => false,
|
||||
'default' => '',
|
||||
]);
|
||||
return $schema;
|
||||
// $metadataTable->addColumn('value', Types::TEXT, [
|
||||
// 'notnull' => false,
|
||||
// 'default' => '',
|
||||
// ]);
|
||||
// return $schema;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -74,17 +75,17 @@ class Version27000Date20230309104325 extends SimpleMigrationStep {
|
|||
*/
|
||||
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
$metadataTable = $schema->getTable('file_metadata');
|
||||
// $schema = $schemaClosure();
|
||||
// $metadataTable = $schema->getTable('file_metadata');
|
||||
|
||||
if (!$metadataTable->hasColumn('metadata')) {
|
||||
return;
|
||||
}
|
||||
// if (!$metadataTable->hasColumn('metadata')) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
$this->connection
|
||||
->getQueryBuilder()
|
||||
->update('file_metadata')
|
||||
->set('value', 'metadata')
|
||||
->executeStatement();
|
||||
// $this->connection
|
||||
// ->getQueryBuilder()
|
||||
// ->update('file_metadata')
|
||||
// ->set('value', 'metadata')
|
||||
// ->executeStatement();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,14 +43,14 @@ class Version27000Date20230309104802 extends SimpleMigrationStep {
|
|||
* @return null|ISchemaWrapper
|
||||
*/
|
||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
$metadataTable = $schema->getTable('file_metadata');
|
||||
// /** @var ISchemaWrapper $schema */
|
||||
// $schema = $schemaClosure();
|
||||
// $metadataTable = $schema->getTable('file_metadata');
|
||||
|
||||
if ($metadataTable->hasColumn('metadata')) {
|
||||
$metadataTable->dropColumn('metadata');
|
||||
return $schema;
|
||||
}
|
||||
// if ($metadataTable->hasColumn('metadata')) {
|
||||
// $metadataTable->dropColumn('metadata');
|
||||
// return $schema;
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue