From fec1c091a0e554f97d6456541ef13c648aed50cf Mon Sep 17 00:00:00 2001 From: JiaJia Ji Date: Tue, 22 Oct 2024 13:44:44 +0200 Subject: [PATCH] [Improvement]: Add `versionCount` index to element and versions table (#17744) --- .../src/Migrations/Version20241021111028.php | 56 +++++++++++++++++++ bundles/InstallBundle/dump/install.sql | 12 ++-- .../09_Upgrade_Notes/README.md | 5 ++ 3 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 bundles/CoreBundle/src/Migrations/Version20241021111028.php diff --git a/bundles/CoreBundle/src/Migrations/Version20241021111028.php b/bundles/CoreBundle/src/Migrations/Version20241021111028.php new file mode 100644 index 00000000000..1bdd9fba4d0 --- /dev/null +++ b/bundles/CoreBundle/src/Migrations/Version20241021111028.php @@ -0,0 +1,56 @@ +tables as $table) { + $dbTable = $schema->getTable($table); + if (!$dbTable->hasIndex('versionCount')) { + $dbTable->addIndex(['versionCount'], 'versionCount'); + } + } + } + + public function down(Schema $schema): void + { + foreach ($this->tables as $table) { + $dbTable = $schema->getTable($table); + if ($dbTable->hasIndex('versionCount')) { + $dbTable->dropIndex('versionCount'); + } + } + } +} diff --git a/bundles/InstallBundle/dump/install.sql b/bundles/InstallBundle/dump/install.sql index 607a5ad5b0f..531e0d5f4b4 100644 --- a/bundles/InstallBundle/dump/install.sql +++ b/bundles/InstallBundle/dump/install.sql @@ -20,7 +20,8 @@ CREATE TABLE `assets` ( UNIQUE KEY `fullpath` (`path`,`filename`), KEY `parentId` (`parentId`), KEY `filename` (`filename`), - KEY `modificationDate` (`modificationDate`) + KEY `modificationDate` (`modificationDate`), + KEY `versionCount` (`versionCount`) ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; DROP TABLE IF EXISTS `assets_metadata`; @@ -90,7 +91,8 @@ CREATE TABLE `documents` ( KEY `parentId` (`parentId`), KEY `key` (`key`), KEY `published` (`published`), - KEY `modificationDate` (`modificationDate`) + KEY `modificationDate` (`modificationDate`), + KEY `versionCount` (`versionCount`) ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; DROP TABLE IF EXISTS `documents_editables`; @@ -290,7 +292,8 @@ CREATE TABLE `objects` ( KEY `parentId` (`parentId`), KEY `type_path_classId` (`type`, `path`, `classId`), KEY `modificationDate` (`modificationDate`), - KEY `classId` (`classId`) + KEY `classId` (`classId`), + KEY `versionCount` (`versionCount`) ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; DROP TABLE IF EXISTS `properties`; @@ -588,7 +591,8 @@ CREATE TABLE `versions` ( KEY `date` (`date`), KEY `binaryFileHash` (`binaryFileHash`), KEY `autoSave` (`autoSave`), - KEY `stackTrace` (`stackTrace`(1)) + KEY `stackTrace` (`stackTrace`(1)), + KEY `versionCount` (`versionCount`) ) DEFAULT CHARSET=utf8mb4; DROP TABLE IF EXISTS `website_settings`; diff --git a/doc/23_Installation_and_Upgrade/09_Upgrade_Notes/README.md b/doc/23_Installation_and_Upgrade/09_Upgrade_Notes/README.md index 9d8951a0a49..d113d8dde4d 100644 --- a/doc/23_Installation_and_Upgrade/09_Upgrade_Notes/README.md +++ b/doc/23_Installation_and_Upgrade/09_Upgrade_Notes/README.md @@ -3,6 +3,11 @@ ### [Events] - `context` property of `ResolveUploadTargetEvent` is deprecated. Use `setArgument()` method instead. +## Pimcore 11.5.0 +### General +#### [Database] +- Added an index on `versionCount` columns + ## Pimcore 11.4.0 ### General #### [Logging]