From 9edfda4918df5af17b94a8ef971d6901afec2668 Mon Sep 17 00:00:00 2001 From: Karsten Dambekalns Date: Sun, 30 Apr 2023 20:46:06 +0200 Subject: [PATCH] TASK: Fix MySQL migration differences on fresh setup Fixes #3118 (at least partly.) --- .../Mysql/Version20230430183156.php | 38 ++++++++++++++++++ .../Mysql/Version20230430183157.php | 40 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 Neos.ContentRepository/Migrations/Mysql/Version20230430183156.php create mode 100644 Neos.Media/Migrations/Mysql/Version20230430183157.php diff --git a/Neos.ContentRepository/Migrations/Mysql/Version20230430183156.php b/Neos.ContentRepository/Migrations/Mysql/Version20230430183156.php new file mode 100644 index 00000000000..c2603fa7c20 --- /dev/null +++ b/Neos.ContentRepository/Migrations/Mysql/Version20230430183156.php @@ -0,0 +1,38 @@ +abortIf( + !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MysqlPlatform, + "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MysqlPlatform'." + ); + + $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)'); + } + + public function down(Schema $schema): void + { + $this->abortIf( + !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MysqlPlatform, + "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MysqlPlatform'." + ); + + $this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX UNIQ_CE6515692D45FE4D, ADD INDEX IDX_CE6515692D45FE4D (movedto)'); + } +} diff --git a/Neos.Media/Migrations/Mysql/Version20230430183157.php b/Neos.Media/Migrations/Mysql/Version20230430183157.php new file mode 100644 index 00000000000..28789cf5d5d --- /dev/null +++ b/Neos.Media/Migrations/Mysql/Version20230430183157.php @@ -0,0 +1,40 @@ +abortIf( + !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MysqlPlatform, + "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MysqlPlatform'." + ); + + $this->addSql('ALTER TABLE neos_media_domain_model_tag DROP FOREIGN KEY FK_CA4889693D8E604F'); + $this->addSql('ALTER TABLE neos_media_domain_model_tag ADD CONSTRAINT FK_CA4889693D8E604F FOREIGN KEY (parent) REFERENCES neos_media_domain_model_tag (persistence_object_identifier) ON DELETE SET NULL'); + } + + public function down(Schema $schema): void + { + $this->abortIf( + !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MysqlPlatform, + "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MysqlPlatform'." + ); + + $this->addSql('ALTER TABLE neos_media_domain_model_tag DROP FOREIGN KEY FK_CA4889693D8E604F'); + $this->addSql('ALTER TABLE neos_media_domain_model_tag ADD CONSTRAINT FK_CA4889693D8E604F FOREIGN KEY (parent) REFERENCES neos_media_domain_model_tag (persistence_object_identifier)'); + } +}