From 534d85459849e56b2fbc7bb32a57d642f624b39e Mon Sep 17 00:00:00 2001 From: Denny Lubitz Date: Wed, 22 Jan 2025 13:24:06 +0100 Subject: [PATCH] TASK: Check if index need to be renamed --- .../Migrations/Mysql/Version20230430183156.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Neos.ContentRepository/Migrations/Mysql/Version20230430183156.php b/Neos.ContentRepository/Migrations/Mysql/Version20230430183156.php index c2603fa7c20..20c16dcad66 100644 --- a/Neos.ContentRepository/Migrations/Mysql/Version20230430183156.php +++ b/Neos.ContentRepository/Migrations/Mysql/Version20230430183156.php @@ -23,6 +23,11 @@ public function up(Schema $schema): void "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MysqlPlatform'." ); + $this->skipIf(!$schema->getTable('neos_contentrepository_domain_model_nodedata')->hasIndex('IDX_CE6515692D45FE4D') + && $schema->getTable('neos_contentrepository_domain_model_nodedata')->hasIndex('UNIQ_CE6515692D45FE4D'), + "Skipped index renaming because they are already named properly" + ); + $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)'); } @@ -33,6 +38,11 @@ public function down(Schema $schema): void "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MysqlPlatform'." ); + $this->skipIf($schema->getTable('neos_contentrepository_domain_model_nodedata')->hasIndex('IDX_CE6515692D45FE4D') + && !$schema->getTable('neos_contentrepository_domain_model_nodedata')->hasIndex('UNIQ_CE6515692D45FE4D'), + "Skipped index renaming because they are already named properly" + ); + $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX UNIQ_CE6515692D45FE4D, ADD INDEX IDX_CE6515692D45FE4D (movedto)'); } }