Skip to content

Commit

Permalink
TASK: Check if index need to be renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
dlubitz committed Jan 22, 2025
1 parent 796fe8f commit 534d854
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Neos.ContentRepository/Migrations/Mysql/Version20230430183156.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)');
}

Expand All @@ -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)');
}
}

0 comments on commit 534d854

Please sign in to comment.