Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable28] Comment legacy file_metadata table migrations #42108

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions core/Migrations/Version24000Date20220404230027.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
43 changes: 22 additions & 21 deletions core/Migrations/Version27000Date20230309104325.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,20 @@ public function __construct(
* @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;
}


Expand All @@ -74,17 +75,17 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
*/
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();
}
}
14 changes: 7 additions & 7 deletions core/Migrations/Version27000Date20230309104802.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading