diff --git a/Neos.Flow/Migrations/Mysql/Version20110613223837.php b/Neos.Flow/Migrations/Mysql/Version20110613223837.php deleted file mode 100644 index a8f43ef1ba..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20110613223837.php +++ /dev/null @@ -1,44 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("CREATE TABLE flow3_resource_resourcepointer (hash VARCHAR(255) NOT NULL, PRIMARY KEY(hash)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB"); - $this->addSql("CREATE TABLE flow3_resource_resource (flow3_persistence_identifier VARCHAR(40) NOT NULL, flow3_resource_resourcepointer VARCHAR(255) DEFAULT NULL, filename VARCHAR(255) DEFAULT NULL, fileextension VARCHAR(255) DEFAULT NULL, INDEX IDX_11FFD19FD0275681 (flow3_resource_resourcepointer), PRIMARY KEY(flow3_persistence_identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB"); - $this->addSql("CREATE TABLE flow3_security_account (flow3_persistence_identifier VARCHAR(40) NOT NULL, party_abstractparty VARCHAR(40) DEFAULT NULL, accountidentifier VARCHAR(255) DEFAULT NULL, authenticationprovidername VARCHAR(255) DEFAULT NULL, credentialssource VARCHAR(255) DEFAULT NULL, creationdate DATETIME DEFAULT NULL, expirationdate DATETIME DEFAULT NULL, roles LONGTEXT DEFAULT NULL COMMENT '(DC2Type:array)', INDEX IDX_44D0753B38110E12 (party_abstractparty), PRIMARY KEY(flow3_persistence_identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB"); - $this->addSql("CREATE TABLE flow3_resource_securitypublishingconfiguration (flow3_persistence_identifier VARCHAR(40) NOT NULL, allowedroles LONGTEXT DEFAULT NULL COMMENT '(DC2Type:array)', PRIMARY KEY(flow3_persistence_identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB"); - $this->addSql("CREATE TABLE flow3_policy_role (identifier VARCHAR(255) NOT NULL, PRIMARY KEY(identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB"); - $this->addSql("ALTER TABLE flow3_resource_resource ADD CONSTRAINT flow3_resource_resource_ibfk_1 FOREIGN KEY (flow3_resource_resourcepointer) REFERENCES flow3_resource_resourcepointer(hash)"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("ALTER TABLE flow3_resource_resource DROP FOREIGN KEY flow3_resource_resource_ibfk_1"); - $this->addSql("DROP TABLE flow3_resource_resourcepointer"); - $this->addSql("DROP TABLE flow3_resource_resource"); - $this->addSql("DROP TABLE flow3_security_account"); - $this->addSql("DROP TABLE flow3_resource_securitypublishingconfiguration"); - $this->addSql("DROP TABLE flow3_policy_role"); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20110824124835.php b/Neos.Flow/Migrations/Mysql/Version20110824124835.php deleted file mode 100644 index b39c5b5d12..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20110824124835.php +++ /dev/null @@ -1,42 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("RENAME TABLE flow3_policy_role TO typo3_flow3_security_policy_role"); - $this->addSql("RENAME TABLE flow3_resource_resource TO typo3_flow3_resource_resource"); - $this->addSql("RENAME TABLE flow3_resource_resourcepointer TO typo3_flow3_resource_resourcepointer"); - $this->addSql("RENAME TABLE flow3_resource_securitypublishingconfiguration TO typo3_flow3_security_authorization_resource_securitypublis_6180a"); - $this->addSql("RENAME TABLE flow3_security_account TO typo3_flow3_security_account"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("RENAME TABLE typo3_flow3_security_policy_role TO flow3_policy_role"); - $this->addSql("RENAME TABLE typo3_flow3_resource_resource TO flow3_resource_resource"); - $this->addSql("RENAME TABLE typo3_flow3_resource_resourcepointer TO flow3_resource_resourcepointer"); - $this->addSql("RENAME TABLE typo3_flow3_security_authorization_resource_securitypublis_6180a TO flow3_resource_securitypublishingconfiguration"); - $this->addSql("RENAME TABLE typo3_flow3_security_account TO flow3_security_account"); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20110920125736.php b/Neos.Flow/Migrations/Mysql/Version20110920125736.php deleted file mode 100644 index f278929c88..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20110920125736.php +++ /dev/null @@ -1,34 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("CREATE TABLE typo3_flow3_mvc_web_routing_objectpathmapping (objecttype VARCHAR(255) NOT NULL, uripattern VARCHAR(255) NOT NULL, pathsegment VARCHAR(255) NOT NULL, identifier VARCHAR(255) DEFAULT NULL, PRIMARY KEY(objecttype, uripattern, pathsegment)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("DROP TABLE typo3_flow3_mvc_web_routing_objectpathmapping"); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20110923125535.php b/Neos.Flow/Migrations/Mysql/Version20110923125535.php deleted file mode 100644 index 1ef7ba23dc..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20110923125535.php +++ /dev/null @@ -1,70 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("ALTER TABLE typo3_flow3_resource_resource DROP FOREIGN KEY typo3_flow3_resource_resource_ibfk_1"); - $this->addSql("DROP INDEX IDX_11FFD19FD0275681 ON typo3_flow3_resource_resource"); - $this->addSql("ALTER TABLE typo3_flow3_resource_resource CHANGE flow3_resource_resourcepointer resourcepointer VARCHAR(255) DEFAULT NULL"); - $this->addSql("ALTER TABLE typo3_flow3_resource_resource ADD CONSTRAINT typo3_flow3_resource_resource_ibfk_1 FOREIGN KEY (resourcepointer) REFERENCES typo3_flow3_resource_resourcepointer(hash)"); - $this->addSql("CREATE INDEX IDX_B4D45B323CB65D1 ON typo3_flow3_resource_resource (resourcepointer)"); - - if ($this->isPartyPackageInstalled()) { - $this->addSql("ALTER TABLE typo3_flow3_security_account DROP FOREIGN KEY typo3_flow3_security_account_ibfk_1"); - $this->addSql("DROP INDEX IDX_44D0753B38110E12 ON typo3_flow3_security_account"); - } - $this->addSql("ALTER TABLE typo3_flow3_security_account CHANGE party_abstractparty party VARCHAR(40) DEFAULT NULL"); - if ($this->isPartyPackageInstalled()) { - $this->addSql("ALTER TABLE typo3_flow3_security_account ADD CONSTRAINT typo3_flow3_security_account_ibfk_1 FOREIGN KEY (party) REFERENCES typo3_party_domain_model_abstractparty(flow3_persistence_identifier)"); - $this->addSql("CREATE INDEX IDX_65EFB31C89954EE0 ON typo3_flow3_security_account (party)"); - } - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("ALTER TABLE typo3_flow3_resource_resource DROP FOREIGN KEY typo3_flow3_resource_resource_ibfk_1"); - $this->addSql("DROP INDEX IDX_B4D45B323CB65D1 ON typo3_flow3_resource_resource"); - $this->addSql("ALTER TABLE typo3_flow3_resource_resource CHANGE resourcepointer flow3_resource_resourcepointer VARCHAR(255) DEFAULT NULL"); - $this->addSql("ALTER TABLE typo3_flow3_resource_resource ADD CONSTRAINT typo3_flow3_resource_resource_ibfk_1 FOREIGN KEY (flow3_resource_resourcepointer) REFERENCES typo3_flow3_resource_resourcepointer(hash)"); - $this->addSql("CREATE INDEX IDX_11FFD19FD0275681 ON typo3_flow3_resource_resource (flow3_resource_resourcepointer)"); - - if ($this->isPartyPackageInstalled()) { - $this->addSql("ALTER TABLE typo3_flow3_security_account DROP FOREIGN KEY typo3_flow3_security_account_ibfk_1"); - $this->addSql("DROP INDEX IDX_65EFB31C89954EE0 ON typo3_flow3_security_account"); - } - $this->addSql("ALTER TABLE typo3_flow3_security_account CHANGE party party_abstractparty VARCHAR(40) DEFAULT NULL"); - if ($this->isPartyPackageInstalled()) { - $this->addSql("ALTER TABLE typo3_flow3_security_account ADD CONSTRAINT typo3_flow3_security_account_ibfk_1 FOREIGN KEY (party_abstractparty) REFERENCES typo3_party_domain_model_abstractparty(flow3_persistence_identifier)"); - $this->addSql("CREATE INDEX IDX_44D0753B38110E12 ON typo3_flow3_security_account (party_abstractparty)"); - } - } - - /** - * @return boolean - */ - protected function isPartyPackageInstalled() - { - return $this->sm->tablesExist(array('typo3_party_domain_model_abstractparty')); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20120328152041.php b/Neos.Flow/Migrations/Mysql/Version20120328152041.php deleted file mode 100644 index 83d9615795..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20120328152041.php +++ /dev/null @@ -1,34 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("RENAME TABLE typo3_flow3_mvc_web_routing_objectpathmapping TO typo3_flow3_mvc_routing_objectpathmapping"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("RENAME TABLE typo3_flow3_mvc_routing_objectpathmapping TO typo3_flow3_mvc_web_routing_objectpathmapping"); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20120329220340.php b/Neos.Flow/Migrations/Mysql/Version20120329220340.php deleted file mode 100644 index c937fb4028..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20120329220340.php +++ /dev/null @@ -1,40 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("ALTER TABLE typo3_flow3_mvc_routing_objectpathmapping CHANGE identifier identifier VARCHAR(255) NOT NULL"); - $this->addSql("ALTER TABLE typo3_flow3_resource_resource CHANGE filename filename VARCHAR(255) NOT NULL, CHANGE fileextension fileextension VARCHAR(255) NOT NULL"); - $this->addSql("ALTER TABLE typo3_flow3_security_authorization_resource_securitypublis_6180a CHANGE allowedroles allowedroles LONGTEXT NOT NULL COMMENT '(DC2Type:array)'"); - $this->addSql("ALTER TABLE typo3_flow3_security_account CHANGE accountidentifier accountidentifier VARCHAR(255) NOT NULL, CHANGE authenticationprovidername authenticationprovidername VARCHAR(255) NOT NULL, CHANGE credentialssource credentialssource VARCHAR(255) NOT NULL, CHANGE creationdate creationdate DATETIME NOT NULL, CHANGE roles roles LONGTEXT NOT NULL COMMENT '(DC2Type:array)'"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("ALTER TABLE typo3_flow3_mvc_routing_objectpathmapping CHANGE identifier identifier VARCHAR(255) DEFAULT NULL"); - $this->addSql("ALTER TABLE typo3_flow3_resource_resource CHANGE filename filename VARCHAR(255) DEFAULT NULL, CHANGE fileextension fileextension VARCHAR(255) DEFAULT NULL"); - $this->addSql("ALTER TABLE typo3_flow3_security_account CHANGE accountidentifier accountidentifier VARCHAR(255) DEFAULT NULL, CHANGE authenticationprovidername authenticationprovidername VARCHAR(255) DEFAULT NULL, CHANGE credentialssource credentialssource VARCHAR(255) DEFAULT NULL, CHANGE creationdate creationdate DATETIME DEFAULT NULL, CHANGE roles roles LONGTEXT DEFAULT NULL COMMENT '(DC2Type:array)'"); - $this->addSql("ALTER TABLE typo3_flow3_security_authorization_resource_securitypublis_6180a CHANGE allowedroles allowedroles LONGTEXT DEFAULT NULL COMMENT '(DC2Type:array)'"); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20120412093748.php b/Neos.Flow/Migrations/Mysql/Version20120412093748.php deleted file mode 100644 index 37de2bd1a0..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20120412093748.php +++ /dev/null @@ -1,34 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("RENAME TABLE typo3_flow3_security_authorization_resource_securitypublis_6180a TO typo3_flow3_security_authorization_resource_securitypubli_6180a"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("RENAME TABLE typo3_flow3_security_authorization_resource_securitypubli_6180a TO typo3_flow3_security_authorization_resource_securitypublis_6180a"); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20120429213445.php b/Neos.Flow/Migrations/Mysql/Version20120429213445.php deleted file mode 100644 index 91e4eb86e0..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20120429213445.php +++ /dev/null @@ -1,34 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("CREATE UNIQUE INDEX flow3_identity_typo3_flow3_security_account ON typo3_flow3_security_account (accountidentifier, authenticationprovidername)"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("DROP INDEX flow3_identity_typo3_flow3_security_account ON typo3_flow3_security_account"); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20120520211354.php b/Neos.Flow/Migrations/Mysql/Version20120520211354.php deleted file mode 100644 index 39638e95b0..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20120520211354.php +++ /dev/null @@ -1,34 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("ALTER TABLE typo3_flow3_security_account CHANGE credentialssource credentialssource VARCHAR(255) DEFAULT NULL"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("ALTER TABLE typo3_flow3_security_account CHANGE credentialssource credentialssource VARCHAR(255) NOT NULL"); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20120625211647.php b/Neos.Flow/Migrations/Mysql/Version20120625211647.php deleted file mode 100644 index 6305cf2195..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20120625211647.php +++ /dev/null @@ -1,47 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("CREATE TABLE typo3_flow3_resource_publishing_abstractpublishingconfiguration (flow3_persistence_identifier VARCHAR(40) NOT NULL, dtype VARCHAR(255) NOT NULL, PRIMARY KEY(flow3_persistence_identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB"); - - $this->addSql("ALTER TABLE typo3_flow3_resource_resource ADD publishingconfiguration VARCHAR(40) DEFAULT NULL"); - $this->addSql("ALTER TABLE typo3_flow3_resource_resource ADD CONSTRAINT FK_B4D45B32A4A851AF FOREIGN KEY (publishingconfiguration) REFERENCES typo3_flow3_resource_publishing_abstractpublishingconfiguration (flow3_persistence_identifier)"); - $this->addSql("CREATE INDEX IDX_B4D45B32A4A851AF ON typo3_flow3_resource_resource (publishingconfiguration)"); - - $this->addSql("ALTER TABLE typo3_flow3_security_authorization_resource_securitypubli_6180a ADD CONSTRAINT FK_234846D521E3D446 FOREIGN KEY (flow3_persistence_identifier) REFERENCES typo3_flow3_resource_publishing_abstractpublishingconfiguration (flow3_persistence_identifier) ON DELETE CASCADE"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("ALTER TABLE typo3_flow3_resource_resource DROP FOREIGN KEY FK_B4D45B32A4A851AF"); - $this->addSql("DROP INDEX IDX_B4D45B32A4A851AF ON typo3_flow3_resource_resource"); - $this->addSql("ALTER TABLE typo3_flow3_resource_resource DROP publishingconfiguration"); - - $this->addSql("ALTER TABLE typo3_flow3_security_authorization_resource_securitypubli_6180a DROP FOREIGN KEY FK_234846D521E3D446"); - - $this->addSql("DROP TABLE typo3_flow3_resource_publishing_abstractpublishingconfiguration"); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20120930203452.php b/Neos.Flow/Migrations/Mysql/Version20120930203452.php deleted file mode 100644 index 9ec7b98708..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20120930203452.php +++ /dev/null @@ -1,115 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - // collect foreign keys pointing to "our" tables - $tableNames = array( - 'typo3_flow3_resource_publishing_abstractpublishingconfiguration', - 'typo3_flow3_resource_resource', - 'typo3_flow3_security_account', - 'typo3_flow3_security_authorization_resource_securitypubli_6180a', - ); - $foreignKeyHandlingSql = Service::getForeignKeyHandlingSql($schema, $this->platform, $tableNames, 'flow3_persistence_identifier', 'persistence_object_identifier'); - - // drop FK constraints - foreach ($foreignKeyHandlingSql['drop'] as $sql) { - $this->addSql($sql); - } - - // rename identifier fields - $this->addSql("ALTER TABLE typo3_flow3_resource_publishing_abstractpublishingconfiguration DROP PRIMARY KEY"); - $this->addSql("ALTER TABLE typo3_flow3_resource_publishing_abstractpublishingconfiguration CHANGE flow3_persistence_identifier persistence_object_identifier VARCHAR(40) NOT NULL"); - $this->addSql("ALTER TABLE typo3_flow3_resource_publishing_abstractpublishingconfiguration ADD PRIMARY KEY (persistence_object_identifier)"); - $this->addSql("ALTER TABLE typo3_flow3_resource_resource DROP PRIMARY KEY"); - $this->addSql("ALTER TABLE typo3_flow3_resource_resource CHANGE flow3_persistence_identifier persistence_object_identifier VARCHAR(40) NOT NULL"); - $this->addSql("ALTER TABLE typo3_flow3_resource_resource ADD PRIMARY KEY (persistence_object_identifier)"); - $this->addSql("ALTER TABLE typo3_flow3_security_account DROP PRIMARY KEY"); - $this->addSql("ALTER TABLE typo3_flow3_security_account CHANGE flow3_persistence_identifier persistence_object_identifier VARCHAR(40) NOT NULL"); - $this->addSql("ALTER TABLE typo3_flow3_security_account ADD PRIMARY KEY (persistence_object_identifier)"); - $this->addSql("ALTER TABLE typo3_flow3_security_authorization_resource_securitypubli_6180a DROP PRIMARY KEY"); - $this->addSql("ALTER TABLE typo3_flow3_security_authorization_resource_securitypubli_6180a CHANGE flow3_persistence_identifier persistence_object_identifier VARCHAR(40) NOT NULL"); - $this->addSql("ALTER TABLE typo3_flow3_security_authorization_resource_securitypubli_6180a ADD PRIMARY KEY (persistence_object_identifier)"); - - // add back FK constraints - foreach ($foreignKeyHandlingSql['add'] as $sql) { - $this->addSql($sql); - } - - // rename tables - $this->addSql("RENAME TABLE typo3_flow3_mvc_routing_objectpathmapping TO typo3_flow_mvc_routing_objectpathmapping"); - $this->addSql("RENAME TABLE typo3_flow3_resource_publishing_abstractpublishingconfiguration TO typo3_flow_resource_publishing_abstractpublishingconfiguration"); - $this->addSql("RENAME TABLE typo3_flow3_resource_resource TO typo3_flow_resource_resource"); - $this->addSql("RENAME TABLE typo3_flow3_resource_resourcepointer TO typo3_flow_resource_resourcepointer"); - $this->addSql("RENAME TABLE typo3_flow3_security_account TO typo3_flow_security_account"); - $this->addSql("RENAME TABLE typo3_flow3_security_authorization_resource_securitypubli_6180a TO typo3_flow_security_authorization_resource_securitypublis_861cb"); - $this->addSql("RENAME TABLE typo3_flow3_security_policy_role TO typo3_flow_security_policy_role"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - // collect foreign keys pointing to "our" tables - $tableNames = array( - 'typo3_flow_resource_publishing_abstractpublishingconfiguration', - 'typo3_flow_resource_resource', - 'typo3_flow_security_account', - 'typo3_flow_security_authorization_resource_securitypublis_861cb', - ); - $foreignKeyHandlingSql = \Neos\Flow\Persistence\Doctrine\Service::getForeignKeyHandlingSql($schema, $this->platform, $tableNames, 'persistence_object_identifier', 'flow3_persistence_identifier'); - - // drop FK constraints - foreach ($foreignKeyHandlingSql['drop'] as $sql) { - $this->addSql($sql); - } - - // rename identifier fields - $this->addSql("ALTER TABLE typo3_flow_resource_publishing_abstractpublishingconfiguration DROP PRIMARY KEY"); - $this->addSql("ALTER TABLE typo3_flow_resource_publishing_abstractpublishingconfiguration CHANGE persistence_object_identifier flow3_persistence_identifier VARCHAR(40) NOT NULL"); - $this->addSql("ALTER TABLE typo3_flow_resource_publishing_abstractpublishingconfiguration ADD PRIMARY KEY (flow3_persistence_identifier)"); - $this->addSql("ALTER TABLE typo3_flow_resource_resource DROP PRIMARY KEY"); - $this->addSql("ALTER TABLE typo3_flow_resource_resource CHANGE persistence_object_identifier flow3_persistence_identifier VARCHAR(40) NOT NULL"); - $this->addSql("ALTER TABLE typo3_flow_resource_resource ADD PRIMARY KEY (flow3_persistence_identifier)"); - $this->addSql("ALTER TABLE typo3_flow_security_account DROP PRIMARY KEY"); - $this->addSql("ALTER TABLE typo3_flow_security_account CHANGE persistence_object_identifier flow3_persistence_identifier VARCHAR(40) NOT NULL"); - $this->addSql("ALTER TABLE typo3_flow_security_account ADD PRIMARY KEY (flow3_persistence_identifier)"); - $this->addSql("ALTER TABLE typo3_flow_security_authorization_resource_securitypublis_861cb DROP PRIMARY KEY"); - $this->addSql("ALTER TABLE typo3_flow_security_authorization_resource_securitypublis_861cb CHANGE persistence_object_identifier flow3_persistence_identifier VARCHAR(40) NOT NULL"); - $this->addSql("ALTER TABLE typo3_flow_security_authorization_resource_securitypublis_861cb ADD PRIMARY KEY (flow3_persistence_identifier)"); - - // add back FK constraints - foreach ($foreignKeyHandlingSql['add'] as $sql) { - $this->addSql($sql); - } - - // rename tables - $this->addSql("RENAME TABLE typo3_flow_mvc_routing_objectpathmapping TO typo3_flow3_mvc_routing_objectpathmapping"); - $this->addSql("RENAME TABLE typo3_flow_resource_publishing_abstractpublishingconfiguration TO typo3_flow3_resource_publishing_abstractpublishingconfiguration"); - $this->addSql("RENAME TABLE typo3_flow_resource_resource TO typo3_flow3_resource_resource"); - $this->addSql("RENAME TABLE typo3_flow_resource_resourcepointer TO typo3_flow3_resource_resourcepointer"); - $this->addSql("RENAME TABLE typo3_flow_security_account TO typo3_flow3_security_account"); - $this->addSql("RENAME TABLE typo3_flow_security_authorization_resource_securitypublis_861cb TO typo3_flow3_security_authorization_resource_securitypubli_6180a"); - $this->addSql("RENAME TABLE typo3_flow_security_policy_role TO typo3_flow3_security_policy_role"); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20130319131400.php b/Neos.Flow/Migrations/Mysql/Version20130319131400.php deleted file mode 100644 index ee600aebef..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20130319131400.php +++ /dev/null @@ -1,185 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("CREATE TABLE typo3_flow_security_account_roles_join (flow_security_account VARCHAR(40) NOT NULL, flow_policy_role VARCHAR(255) NOT NULL, INDEX IDX_ADF11BBC58842EFC (flow_security_account), INDEX IDX_ADF11BBC23A1047C (flow_policy_role), PRIMARY KEY(flow_security_account, flow_policy_role)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB"); - $this->addSql("CREATE TABLE typo3_flow_security_policy_role_parentroles_join (flow_policy_role VARCHAR(255) NOT NULL, parent_role VARCHAR(255) NOT NULL, INDEX IDX_D459C58E23A1047C (flow_policy_role), INDEX IDX_D459C58E6A8ABCDE (parent_role), PRIMARY KEY (flow_policy_role, parent_role)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB"); - - $this->addSql("ALTER TABLE typo3_flow_security_account_roles_join ADD CONSTRAINT FK_ADF11BBC58842EFC FOREIGN KEY (flow_security_account) REFERENCES typo3_flow_security_account (persistence_object_identifier)"); - $this->addSql("ALTER TABLE typo3_flow_security_account_roles_join ADD CONSTRAINT FK_ADF11BBC23A1047C FOREIGN KEY (flow_policy_role) REFERENCES typo3_flow_security_policy_role (identifier)"); - $this->addSql("ALTER TABLE typo3_flow_security_policy_role_parentroles_join ADD CONSTRAINT FK_D459C58E23A1047C FOREIGN KEY (flow_policy_role) REFERENCES typo3_flow_security_policy_role (identifier)"); - $this->addSql("ALTER TABLE typo3_flow_security_policy_role_parentroles_join ADD CONSTRAINT FK_D459C58E6A8ABCDE FOREIGN KEY (parent_role) REFERENCES typo3_flow_security_policy_role (identifier)"); - $this->addSql("ALTER TABLE typo3_flow_security_policy_role ADD sourcehint VARCHAR(6) NOT NULL"); - - $this->migrateAccountRolesUp(); - - $this->addSql("ALTER TABLE typo3_flow_security_account DROP roles"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("DROP TABLE typo3_flow_security_account_roles_join"); - $this->addSql("DROP TABLE typo3_flow_security_policy_role_parentroles_join"); - $this->addSql("ALTER TABLE typo3_flow_security_policy_role DROP sourcehint"); - $this->addSql("ALTER TABLE typo3_flow_security_account ADD roles LONGTEXT NOT NULL COMMENT '(DC2Type:array)'"); - - $this->migrateAccountRolesDown(); - - $this->addSql("TRUNCATE TABLE typo3_flow_security_policy_role"); - } - - /** - * Generate SQL statements to migrate accounts up to referenced roles. - * - * @return void - */ - protected function migrateAccountRolesUp() - { - if (!$this->sm->tablesExist(['typo3_flow_security_account'])) { - return; - } - $rolesSql = array(); - $accountRolesSql = array(); - $rolesToMigrate = array(); - - $accountsResult = $this->connection->executeQuery('SELECT DISTINCT(roles) FROM typo3_flow_security_account'); - while ($accountIdentifierAndRoles = $accountsResult->fetch(\PDO::FETCH_ASSOC)) { - $roleIdentifiers = unserialize($accountIdentifierAndRoles['roles']); - foreach ($roleIdentifiers as $roleIdentifier) { - $rolesToMigrate[$roleIdentifier] = true; - } - } - - $roleIdentifierMap = $this->getRoleIdentifierMap($rolesToMigrate); - - $accountsResult = $this->connection->executeQuery('SELECT persistence_object_identifier, roles FROM typo3_flow_security_account'); - while ($accountIdentifierAndRoles = $accountsResult->fetch(\PDO::FETCH_ASSOC)) { - $accountIdentifier = $accountIdentifierAndRoles['persistence_object_identifier']; - $roleIdentifiers = unserialize($accountIdentifierAndRoles['roles']); - foreach ($roleIdentifiers as $roleIdentifier) { - $roleIdentifier = $roleIdentifierMap[$roleIdentifier]; - $rolesSql[$roleIdentifier] = "INSERT INTO typo3_flow_security_policy_role (identifier, sourcehint) VALUES (" . $this->connection->quote($roleIdentifier) . ", 'policy')"; - $accountRolesSql[] = "INSERT INTO typo3_flow_security_account_roles_join (flow_security_account, flow_policy_role) VALUES (" . $this->connection->quote($accountIdentifier) . ", " . $this->connection->quote($roleIdentifier) . ")"; - } - } - - foreach ($rolesSql as $sql) { - $this->addSql($sql); - } - foreach ($accountRolesSql as $sql) { - $this->addSql($sql); - } - } - - /** - * Generate SQL statements to migrate accounts down to embedded roles. - * - * @return void - */ - protected function migrateAccountRolesDown() - { - if (!$this->sm->tablesExist(['typo3_flow_security_account_roles_join', 'typo3_flow_security_policy_role'])) { - return; - } - $accountsWithRoles = array(); - - $accountRolesResult = $this->connection->executeQuery('SELECT j.flow_security_account, r.identifier FROM typo3_flow_security_account_roles_join as j LEFT JOIN typo3_flow_security_policy_role AS r ON j.flow_policy_role = r.identifier'); - while ($accountIdentifierAndRole = $accountRolesResult->fetch(\PDO::FETCH_ASSOC)) { - $accountIdentifier = $accountIdentifierAndRole['flow_security_account']; - $roleIdentifier = $accountIdentifierAndRole['identifier']; - $accountsWithRoles[$accountIdentifier][] = substr($roleIdentifier, strrpos($roleIdentifier, ':') + 1); - } - - foreach ($accountsWithRoles as $accountIdentifier => $roles) { - $this->addSql("UPDATE typo3_flow_security_account SET roles = " . $this->connection->quote(serialize($roles)) . " WHERE persistence_object_identifier = " . $this->connection->quote($accountIdentifier)); - } - } - - /** - * Returns the given array indexed by "old" role identifiers with the - * "new" identifiers added as values to their matching index. - * - * @param array $map - * @return array - */ - protected function getRoleIdentifierMap(array $map) - { - $rolesFromPolicy = $this->loadRolesFromPolicyFiles(); - - foreach ($rolesFromPolicy as $newRoleIdentifier) { - $map[substr($newRoleIdentifier, strrpos($newRoleIdentifier, ':') + 1)] = $newRoleIdentifier; - } - - $map['Anonymous'] ='Anonymous'; - $map['Everybody'] = 'Everybody'; - - return $map; - } - - /** - * Reads all Policy.yaml files below Packages, extracts the roles and prepends - * them with the package key "guessed" from the path. - * - * @return array - */ - protected function loadRolesFromPolicyFiles() - { - $roles = array(); - - $yamlPathsAndFilenames = Files::readDirectoryRecursively(__DIR__ . '/../../../../../Packages', 'yaml', true); - $configurationPathsAndFilenames = array_filter($yamlPathsAndFilenames, - function ($pathAndFileName) { - if (basename($pathAndFileName) === 'Policy.yaml') { - return true; - } else { - return false; - } - } - ); - - $yamlSource = new \Neos\Flow\Configuration\Source\YamlSource(); - foreach ($configurationPathsAndFilenames as $pathAndFilename) { - if (preg_match('%Packages/[^/]+/([^/]+)/Configuration/(?:Development/|Production/)?[^/]+%', $pathAndFilename, $matches) === 0) { - continue; - }; - $packageKey = $matches[1]; - $configuration = $yamlSource->load(substr($pathAndFilename, 0, -5)); - if (isset($configuration['roles']) && is_array($configuration['roles'])) { - foreach ($configuration['roles'] as $roleIdentifier => $parentRoles) { - $roles[$packageKey . ':' . $roleIdentifier] = true; - } - } - } - - return array_keys($roles); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20141015125841.php b/Neos.Flow/Migrations/Mysql/Version20141015125841.php deleted file mode 100644 index dfd2dd6857..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20141015125841.php +++ /dev/null @@ -1,132 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql('ALTER TABLE typo3_flow_resource_resource DROP FOREIGN KEY FK_B4D45B32A4A851AF'); - $this->addSql('ALTER TABLE typo3_flow_resource_resource DROP FOREIGN KEY typo3_flow_resource_resource_ibfk_1'); - $this->addSql('DROP INDEX IDX_B4D45B323CB65D1 ON typo3_flow_resource_resource'); - $this->addSql('ALTER TABLE typo3_flow_resource_resource CHANGE resourcepointer sha1 VARCHAR(40) NOT NULL, ADD md5 VARCHAR(32) DEFAULT NULL, ADD collectionname VARCHAR(255) DEFAULT NULL, DROP publishingconfiguration, DROP fileextension, ADD mediatype VARCHAR(100) DEFAULT NULL, ADD relativepublicationpath VARCHAR(255) NOT NULL, ADD filesize NUMERIC(20, 0) DEFAULT NULL'); - $this->addSql('DROP TABLE typo3_flow_resource_resourcepointer'); - } - - /** - * Move resource files to the new locations and adjust records. - * - * @param Schema $schema - * @return void - */ - public function postUp(Schema $schema): void - { - if (!$this->sm->tablesExist(['typo3_flow_resource_resource'])) { - return; - } - $resourcesResult = $this->connection->executeQuery('SELECT persistence_object_identifier, sha1, filename FROM typo3_flow_resource_resource'); - while ($resourceInfo = $resourcesResult->fetch(\PDO::FETCH_ASSOC)) { - $resourcePathAndFilename = FLOW_PATH_DATA . 'Persistent/Resources/' . $resourceInfo['sha1']; - $newResourcePathAndFilename = FLOW_PATH_DATA . 'Persistent/Resources/' . $resourceInfo['sha1'][0] . '/' . $resourceInfo['sha1'][1] . '/' . $resourceInfo['sha1'][2] . '/' . $resourceInfo['sha1'][3] . '/' . $resourceInfo['sha1']; - - $mediaType = MediaTypes::getMediaTypeFromFilename($resourceInfo['filename']); - if (file_exists($resourcePathAndFilename)) { - $md5 = md5_file($resourcePathAndFilename); - $filesize = filesize($resourcePathAndFilename); - - if (!file_exists(dirname($newResourcePathAndFilename))) { - Files::createDirectoryRecursively(dirname($newResourcePathAndFilename)); - } - $result = @rename($resourcePathAndFilename, $newResourcePathAndFilename); - } elseif (file_exists($newResourcePathAndFilename)) { - $md5 = md5_file($newResourcePathAndFilename); - $filesize = filesize($newResourcePathAndFilename); - - $result = true; - } else { - $this->write(sprintf('Error while migrating database for the new resource management: the resource file "%s" (original filename: %s) was not found, but the resource object with uuid %s needs this file.', $resourcePathAndFilename, $resourceInfo['filename'], $resourceInfo['persistence_object_identifier'])); - continue; - } - - $this->connection->executeUpdate( - 'UPDATE typo3_flow_resource_resource SET collectionname = ?, mediatype = ?, md5 = ?, filesize = ? WHERE persistence_object_identifier = ?', - array('persistent', $mediaType, $md5, $filesize, $resourceInfo['persistence_object_identifier']) - ); - - if ($result === false) { - $this->write(sprintf('Could not move the data file of resource "%s" from its legacy location at %s to the correct location %s.', $resourceInfo['sha1'], $resourcePathAndFilename, $newResourcePathAndFilename)); - } - } - $this->connection->exec('ALTER TABLE typo3_flow_resource_resource CHANGE collectionname collectionname VARCHAR(255) NOT NULL, CHANGE mediatype mediatype VARCHAR(100) NOT NULL, CHANGE md5 md5 VARCHAR(32) NOT NULL, CHANGE filesize filesize NUMERIC(20, 0) NOT NULL'); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - $this->addSql('CREATE TABLE typo3_flow_resource_resourcepointer (hash VARCHAR(255) NOT NULL, PRIMARY KEY(hash)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); - - $this->addSql('ALTER TABLE typo3_flow_resource_resource ADD publishingconfiguration VARCHAR(40) DEFAULT NULL, CHANGE sha1 resourcepointer VARCHAR(255) NOT NULL, DROP md5, DROP collectionname, DROP mediatype, DROP relativepublicationpath, DROP filesize, ADD fileextension VARCHAR(255) NOT NULL'); - $this->addSql('ALTER TABLE typo3_flow_resource_resource ADD CONSTRAINT FK_B4D45B32A4A851AF FOREIGN KEY (publishingconfiguration) REFERENCES typo3_flow_resource_publishing_abstractpublishingconfiguration (persistence_object_identifier)'); - $this->addSql('CREATE INDEX IDX_B4D45B323CB65D1 ON typo3_flow_resource_resource (resourcepointer)'); - $this->addSql('CREATE INDEX IDX_B4D45B32A4A851AF ON typo3_flow_resource_resource (publishingconfiguration)'); - } - - /** - * Move resource files back to the old locations and adjust records. - * - * @param Schema $schema - * @return void - */ - public function postDown(Schema $schema): void - { - if (!$this->sm->tablesExist(['typo3_flow_resource_resource'])) { - return; - } - $resourcesResult = $this->connection->executeQuery('SELECT DISTINCT resourcepointer FROM typo3_flow_resource_resource'); - while ($resourceInfo = $resourcesResult->fetch(\PDO::FETCH_ASSOC)) { - $this->connection->executeQuery( - 'INSERT INTO typo3_flow_resource_resourcepointer (hash) VALUES (?)', - array($resourceInfo['resourcepointer']) - ); - - $resourcePathAndFilename = FLOW_PATH_DATA . 'Persistent/Resources/' . $resourceInfo['resourcepointer'][0] . '/' . $resourceInfo['resourcepointer'][1] . '/' . $resourceInfo['resourcepointer'][2] . '/' . $resourceInfo['resourcepointer'][3] . '/' . $resourceInfo['resourcepointer']; - if (!file_exists($resourcePathAndFilename)) { - $this->write(sprintf('Error while migrating database for the old resource management: the resource file "%s" was not found.', $resourcePathAndFilename)); - continue; - } - $newResourcePathAndFilename = FLOW_PATH_DATA . 'Persistent/Resources/' . $resourceInfo['resourcepointer']; - $result = @rename($resourcePathAndFilename, $newResourcePathAndFilename); - if ($result === false) { - $this->write(sprintf('Could not move the data file of resource "%s" from its location at %s to the legacy location %s.', $resourceInfo['resourcepointer'], $resourcePathAndFilename, $newResourcePathAndFilename)); - } - Files::removeEmptyDirectoriesOnPath(dirname($resourcePathAndFilename)); - } - - $this->connection->exec('UPDATE typo3_flow_resource_resource SET fileextension = SUBSTRING_INDEX(filename, \'.\', -1)'); - $this->connection->exec('ALTER TABLE typo3_flow_resource_resource ADD CONSTRAINT typo3_flow_resource_resource_ibfk_1 FOREIGN KEY (resourcepointer) REFERENCES typo3_flow_resource_resourcepointer (hash)'); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20141113173712.php b/Neos.Flow/Migrations/Mysql/Version20141113173712.php deleted file mode 100644 index 35ee31441a..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20141113173712.php +++ /dev/null @@ -1,118 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - // skip execution of corresponding sql queries if migration has been applied already (see https://review.typo3.org/36299) - if(array_key_exists('roleidentifiers', $this->sm->listTableColumns('typo3_flow_security_account'))) { - return; - } - - $this->addSql("ALTER TABLE typo3_flow_security_account ADD roleidentifiers LONGTEXT DEFAULT NULL COMMENT '(DC2Type:simple_array)'"); - $this->addSql("ALTER TABLE typo3_flow_security_account_roles_join DROP FOREIGN KEY FK_ADF11BBC23A1047C"); - - $this->migrateAccountRolesUp(); - - $this->addSql("ALTER TABLE typo3_flow_security_policy_role_parentroles_join DROP FOREIGN KEY FK_D459C58E6A8ABCDE"); - $this->addSql("ALTER TABLE typo3_flow_security_policy_role_parentroles_join DROP FOREIGN KEY FK_D459C58E23A1047C"); - $this->addSql("DROP TABLE typo3_flow_security_account_roles_join"); - $this->addSql("DROP TABLE typo3_flow_security_authorization_resource_securitypublis_861cb"); - $this->addSql("DROP TABLE typo3_flow_security_policy_role"); - $this->addSql("DROP TABLE typo3_flow_security_policy_role_parentroles_join"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("CREATE TABLE typo3_flow_security_account_roles_join (flow_security_account VARCHAR(40) NOT NULL, flow_policy_role VARCHAR(255) NOT NULL, INDEX IDX_ADF11BBC58842EFC (flow_security_account), INDEX IDX_ADF11BBC23A1047C (flow_policy_role), PRIMARY KEY(flow_security_account, flow_policy_role)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB"); - $this->addSql("CREATE TABLE typo3_flow_security_authorization_resource_securitypublis_861cb (persistence_object_identifier VARCHAR(40) NOT NULL, allowedroles LONGTEXT NOT NULL COMMENT '(DC2Type:array)', PRIMARY KEY(persistence_object_identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB"); - $this->addSql("CREATE TABLE typo3_flow_security_policy_role (identifier VARCHAR(255) NOT NULL, sourcehint VARCHAR(6) NOT NULL, PRIMARY KEY(identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB"); - $this->addSql("CREATE TABLE typo3_flow_security_policy_role_parentroles_join (flow_policy_role VARCHAR(255) NOT NULL, parent_role VARCHAR(255) NOT NULL, INDEX IDX_D459C58E23A1047C (flow_policy_role), INDEX IDX_D459C58E6A8ABCDE (parent_role), PRIMARY KEY(flow_policy_role, parent_role)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB"); - - $this->migrateAccountRolesDown(); - - $this->addSql("ALTER TABLE typo3_flow_security_account_roles_join ADD CONSTRAINT FK_ADF11BBC58842EFC FOREIGN KEY (flow_security_account) REFERENCES typo3_flow_security_account (persistence_object_identifier)"); - $this->addSql("ALTER TABLE typo3_flow_security_account_roles_join ADD CONSTRAINT FK_ADF11BBC23A1047C FOREIGN KEY (flow_policy_role) REFERENCES typo3_flow_security_policy_role (identifier)"); - - $this->addSql("ALTER TABLE typo3_flow_security_authorization_resource_securitypublis_861cb ADD CONSTRAINT FK_234846D521E3D446 FOREIGN KEY (persistence_object_identifier) REFERENCES typo3_flow_resource_publishing_abstractpublishingconfiguration (persistence_object_identifier) ON DELETE CASCADE"); - $this->addSql("ALTER TABLE typo3_flow_security_policy_role_parentroles_join ADD CONSTRAINT FK_D459C58E6A8ABCDE FOREIGN KEY (parent_role) REFERENCES typo3_flow_security_policy_role (identifier)"); - $this->addSql("ALTER TABLE typo3_flow_security_policy_role_parentroles_join ADD CONSTRAINT FK_D459C58E23A1047C FOREIGN KEY (flow_policy_role) REFERENCES typo3_flow_security_policy_role (identifier)"); - $this->addSql("ALTER TABLE typo3_flow_security_account DROP roleidentifiers"); - } - - /** - * Generate SQL statements to migrate accounts up to embedded roles. - * - * @return void - */ - protected function migrateAccountRolesUp() - { - if (!$this->sm->tablesExist(['typo3_flow_security_account_roles_join', 'typo3_flow_security_policy_role'])) { - return; - } - $accountsWithRoles = array(); - - $accountRolesResult = $this->connection->executeQuery('SELECT j.flow_security_account, r.identifier FROM typo3_flow_security_account_roles_join as j LEFT JOIN typo3_flow_security_policy_role AS r ON j.flow_policy_role = r.identifier'); - while ($accountIdentifierAndRole = $accountRolesResult->fetch(\PDO::FETCH_ASSOC)) { - $accountIdentifier = $accountIdentifierAndRole['flow_security_account']; - $accountsWithRoles[$accountIdentifier][] = $accountIdentifierAndRole['identifier']; - } - - foreach ($accountsWithRoles as $accountIdentifier => $roles) { - $this->addSql("UPDATE typo3_flow_security_account SET roleidentifiers = " . $this->connection->quote(implode(',', $roles)) . " WHERE persistence_object_identifier = " . $this->connection->quote($accountIdentifier)); - } - } - - /** - * Generate SQL statements to migrate accounts down to embedded roles. - * - * @return void - */ - protected function migrateAccountRolesDown() - { - if (!$this->sm->tablesExist(['typo3_flow_security_account', 'typo3_flow_security_policy_role', 'typo3_flow_security_account_roles_join'])) { - return; - } - $allRolesAndAccounts = array(); - $accountRolesResult = $this->connection->executeQuery('SELECT persistence_object_identifier, roleidentifiers FROM typo3_flow_security_account'); - while ($accountIdentifierAndRoles = $accountRolesResult->fetch(\PDO::FETCH_ASSOC)) { - $accountIdentifier = $accountIdentifierAndRoles['persistence_object_identifier']; - $roleIdentifiers = explode(',', $accountIdentifierAndRoles['roleidentifiers']); - foreach ($roleIdentifiers as $roleIdentifier) { - if (!isset($allRolesAndAccounts[$roleIdentifier])) { - $allRolesAndAccounts[$roleIdentifier] = array(); - } - $allRolesAndAccounts[$roleIdentifier][] = $accountIdentifier; - } - } - $this->addSql("INSERT INTO typo3_flow_security_policy_role (identifier, sourcehint) VALUES ('Everybody', 'system')"); - $this->addSql("INSERT INTO typo3_flow_security_policy_role (identifier, sourcehint) VALUES ('Anonymous', 'system')"); - $this->addSql("INSERT INTO typo3_flow_security_policy_role (identifier, sourcehint) VALUES ('AuthenticatedUser', 'system')"); - foreach ($allRolesAndAccounts as $roleIdentifier => $accountIdentifiers) { - $this->addSql("INSERT INTO typo3_flow_security_policy_role (identifier, sourcehint) VALUES (" . $this->connection->quote($roleIdentifier) . ", 'policy')"); - foreach ($accountIdentifiers as $accountIdentifier) { - $this->addSql("INSERT INTO typo3_flow_security_account_roles_join (flow_security_account, flow_policy_role) VALUES (" . $this->connection->quote($accountIdentifier) . ", " . $this->connection->quote($roleIdentifier) . ")"); - } - } - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20150129225152.php b/Neos.Flow/Migrations/Mysql/Version20150129225152.php deleted file mode 100644 index 494f73b766..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20150129225152.php +++ /dev/null @@ -1,34 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("DROP TABLE typo3_flow_resource_publishing_abstractpublishingconfiguration"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("CREATE TABLE typo3_flow_resource_publishing_abstractpublishingconfiguration (persistence_object_identifier VARCHAR(40) NOT NULL, dtype VARCHAR(255) NOT NULL, PRIMARY KEY(persistence_object_identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB"); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20150206114820.php b/Neos.Flow/Migrations/Mysql/Version20150206114820.php deleted file mode 100644 index 4fe492b552..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20150206114820.php +++ /dev/null @@ -1,58 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - if ($this->isPartyPackageInstalled()) { - $this->addSql("ALTER TABLE typo3_flow_security_account DROP FOREIGN KEY typo3_flow_security_account_ibfk_1"); - $indexes = $this->sm->listTableIndexes('typo3_flow_security_account'); - if (array_key_exists('idx_65efb31c89954ee0', $indexes)) { - $this->addSql("DROP INDEX IDX_65EFB31C89954EE0 ON typo3_flow_security_account"); - } - } - - $this->addSql("ALTER TABLE typo3_flow_security_account DROP party"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("ALTER TABLE typo3_flow_security_account ADD party VARCHAR(40) DEFAULT NULL"); - - if ($this->isPartyPackageInstalled()) { - $this->addSql("CREATE INDEX IDX_65EFB31C89954EE0 ON typo3_flow_security_account (party)"); - $this->addSql("ALTER TABLE typo3_flow_security_account ADD CONSTRAINT typo3_flow_security_account_ibfk_1 FOREIGN KEY (party) REFERENCES typo3_party_domain_model_abstractparty (persistence_object_identifier)"); - } - } - - /** - * @return boolean - */ - protected function isPartyPackageInstalled(): bool - { - return $this->sm->tablesExist(array('typo3_party_domain_model_abstractparty')); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20150309181635.php b/Neos.Flow/Migrations/Mysql/Version20150309181635.php deleted file mode 100644 index 9a9ea1d484..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20150309181635.php +++ /dev/null @@ -1,39 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $indexes = $this->sm->listTableIndexes('typo3_flow_security_account'); - if (array_key_exists('flow3_identity_typo3_flow3_security_account', $indexes)) { - $this->addSql("DROP INDEX flow3_identity_typo3_flow3_security_account ON typo3_flow_security_account"); - $this->addSql("CREATE UNIQUE INDEX flow_identity_typo3_flow_security_account ON typo3_flow_security_account (accountidentifier, authenticationprovidername)"); - } - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql("DROP INDEX flow_identity_typo3_flow_security_account ON typo3_flow_security_account"); - $this->addSql("CREATE UNIQUE INDEX flow3_identity_typo3_flow3_security_account ON typo3_flow_security_account (accountidentifier, authenticationprovidername)"); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20150611154419.php b/Neos.Flow/Migrations/Mysql/Version20150611154419.php deleted file mode 100644 index 290a249e45..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20150611154419.php +++ /dev/null @@ -1,55 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - if (!$this->sm->tablesExist(['typo3_flow_resource_resource'])) { - return; - } - - $resourcesResult = $this->connection->executeQuery('SELECT persistence_object_identifier, sha1, filename FROM typo3_flow_resource_resource'); - while ($resourceInfo = $resourcesResult->fetch(\PDO::FETCH_ASSOC)) { - $resourcePathAndFilename = FLOW_PATH_DATA . 'Persistent/Resources/' . wordwrap($resourceInfo['sha1'], 5, '/', true) . '/' . $resourceInfo['sha1']; - $newResourcePathAndFilename = FLOW_PATH_DATA . 'Persistent/Resources/' . $resourceInfo['sha1'][0] . '/' . $resourceInfo['sha1'][1] . '/' . $resourceInfo['sha1'][2] . '/' . $resourceInfo['sha1'][3] . '/' . $resourceInfo['sha1']; - - if (!file_exists($newResourcePathAndFilename)) { - if (!file_exists($resourcePathAndFilename)) { - $this->write(sprintf('Could not move the data file of resource "%s" from its legacy location at "%s" to the correct location "%s" because the source file does not exist.', $resourceInfo['sha1'], $resourcePathAndFilename, $newResourcePathAndFilename)); - continue; - } - if (!file_exists(dirname($newResourcePathAndFilename))) { - Files::createDirectoryRecursively(dirname($newResourcePathAndFilename)); - } - if (@rename($resourcePathAndFilename, $newResourcePathAndFilename) === false) { - $this->write(sprintf('Could not move the data file of resource "%s" from its legacy location at "%s" to the correct location "%s".', $resourceInfo['sha1'], $resourcePathAndFilename, $newResourcePathAndFilename)); - } - Files::removeEmptyDirectoriesOnPath(dirname($resourcePathAndFilename)); - } - } - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - // no need to move anything back, the original migration expects the resources to be at the new location - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20151110113650.php b/Neos.Flow/Migrations/Mysql/Version20151110113650.php deleted file mode 100644 index 364f57448f..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20151110113650.php +++ /dev/null @@ -1,36 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql('ALTER TABLE typo3_flow_security_account ADD lastsuccessfulauthenticationdate DATETIME DEFAULT NULL, ADD failedauthenticationcount INT DEFAULT 0'); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform)); - - $this->addSql('ALTER TABLE typo3_flow_security_account DROP lastsuccessfulauthenticationdate, DROP failedauthenticationcount'); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20160601164332.php b/Neos.Flow/Migrations/Mysql/Version20160601164332.php deleted file mode 100644 index 963b96f6a3..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20160601164332.php +++ /dev/null @@ -1,35 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - $this->addSql('ALTER TABLE typo3_flow_security_account CHANGE failedauthenticationcount failedauthenticationcount INT DEFAULT NULL'); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - $this->addSql('ALTER TABLE typo3_flow_security_account CHANGE failedauthenticationcount failedauthenticationcount INT DEFAULT 0'); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20161115142022.php b/Neos.Flow/Migrations/Mysql/Version20161115142022.php deleted file mode 100644 index 28d89b5af2..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20161115142022.php +++ /dev/null @@ -1,42 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - $this->addSql('RENAME TABLE typo3_flow_resource_resource TO typo3_flow_resourcemanagement_persistentresource'); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - $this->addSql('RENAME TABLE typo3_flow_resourcemanagement_persistentresource TO typo3_flow_resource_resource'); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20161124185047.php b/Neos.Flow/Migrations/Mysql/Version20161124185047.php deleted file mode 100644 index 4216f648b2..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20161124185047.php +++ /dev/null @@ -1,38 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - $this->addSql('RENAME TABLE typo3_flow_mvc_routing_objectpathmapping TO neos_flow_mvc_routing_objectpathmapping'); - $this->addSql('RENAME TABLE typo3_flow_resourcemanagement_persistentresource TO neos_flow_resourcemanagement_persistentresource'); - $this->addSql('RENAME TABLE typo3_flow_security_account TO neos_flow_security_account'); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - $this->addSql('RENAME TABLE neos_flow_mvc_routing_objectpathmapping TO typo3_flow_mvc_routing_objectpathmapping'); - $this->addSql('RENAME TABLE neos_flow_resourcemanagement_persistentresource TO typo3_flow_resourcemanagement_persistentresource'); - $this->addSql('RENAME TABLE neos_flow_security_account TO typo3_flow_security_account'); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20161125121218.php b/Neos.Flow/Migrations/Mysql/Version20161125121218.php deleted file mode 100644 index 629ad1319b..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20161125121218.php +++ /dev/null @@ -1,40 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - $this->addSql("UPDATE neos_flow_security_account SET roleidentifiers=REPLACE(roleidentifiers, 'TYPO3.Flow:', 'Neos.Flow:')"); - $this->addSql("UPDATE neos_flow_security_account SET roleidentifiers=REPLACE(roleidentifiers, 'TYPO3.Neos:', 'Neos.Neos:')"); - $this->addSql("UPDATE neos_flow_security_account SET roleidentifiers=REPLACE(roleidentifiers, 'TYPO3.TYPO3CR:', 'Neos.ContentRepository:')"); - $this->addSql("UPDATE neos_flow_security_account SET roleidentifiers=REPLACE(roleidentifiers, 'TYPO3.Setup:', 'Neos.Setup:')"); - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - $this->addSql("UPDATE neos_flow_security_account SET roleidentifiers=REPLACE(roleidentifiers, 'Neos.Flow:', 'TYPO3.Flow:')"); - $this->addSql("UPDATE neos_flow_security_account SET roleidentifiers=REPLACE(roleidentifiers, 'Neos.Neos:', 'TYPO3.Neos:')"); - $this->addSql("UPDATE neos_flow_security_account SET roleidentifiers=REPLACE(roleidentifiers, 'Neos.ContentRepository:', 'TYPO3.TYPO3CR:')"); - $this->addSql("UPDATE neos_flow_security_account SET roleidentifiers=REPLACE(roleidentifiers, 'Neos.Setup:', 'TYPO3.Setup:')"); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20170110130149.php b/Neos.Flow/Migrations/Mysql/Version20170110130149.php deleted file mode 100644 index 539d5ab538..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20170110130149.php +++ /dev/null @@ -1,53 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - // Renaming of indexes is only possible with MySQL version 5.7+ - if ($this->connection->getDatabasePlatform() instanceof MySQL57Platform) { - $this->addSql('ALTER TABLE neos_flow_security_account RENAME INDEX flow_identity_typo3_flow_security_account TO flow_identity_neos_flow_security_account'); - } else { - $this->addSql('DROP INDEX flow_identity_typo3_flow_security_account ON neos_flow_security_account'); - $this->addSql('CREATE UNIQUE INDEX flow_identity_neos_flow_security_account ON neos_flow_security_account (accountidentifier, authenticationprovidername)'); - } - } - - /** - * @param Schema $schema - * @return void - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - // Renaming of indexes is only possible with MySQL version 5.7+ - if ($this->connection->getDatabasePlatform() instanceof MySQL57Platform) { - $this->addSql('ALTER TABLE neos_flow_security_account RENAME INDEX flow_identity_neos_flow_security_account TO flow_identity_typo3_flow_security_account'); - } else { - $this->addSql('DROP INDEX flow_identity_neos_flow_security_account ON neos_flow_security_account'); - $this->addSql('CREATE UNIQUE INDEX flow_identity_typo3_flow_security_account ON neos_flow_security_account (accountidentifier, authenticationprovidername)'); - } - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20180622074421.php b/Neos.Flow/Migrations/Mysql/Version20180622074421.php deleted file mode 100644 index 41093fabd7..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20180622074421.php +++ /dev/null @@ -1,51 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - if (array_key_exists('typo3_flow_resource_resource', $this->sm->listTableNames()) !== false - && array_key_exists(strtolower('IDX_35DC14F03332102A'), $this->sm->listTableIndexes('typo3_flow_resource_resource')) === false) { - $this->addSql('CREATE INDEX IDX_35DC14F03332102A ON typo3_flow_resource_resource (sha1)'); - } elseif (array_key_exists(strtolower('IDX_35DC14F03332102A'), $this->sm->listTableIndexes('neos_flow_resourcemanagement_persistentresource')) === false) { - $this->addSql('CREATE INDEX IDX_35DC14F03332102A ON neos_flow_resourcemanagement_persistentresource (sha1)'); - } - } - - /** - * @param Schema $schema - * @return void - * @throws \Doctrine\Migrations\Exception\AbortMigration - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - if (array_key_exists('typo3_flow_resource_resource', $this->sm->listTableNames()) !== false - && array_key_exists(strtolower('IDX_35DC14F03332102A'), $this->sm->listTableIndexes('typo3_flow_resource_resource')) !== false) { - $this->addSql('DROP INDEX IDX_35DC14F03332102A ON typo3_flow_resource_resource'); - } elseif (array_key_exists(strtolower('IDX_35DC14F03332102A'), $this->sm->listTableIndexes('neos_flow_resourcemanagement_persistentresource')) !== false) { - $this->addSql('DROP INDEX IDX_35DC14F03332102A ON neos_flow_resourcemanagement_persistentresource'); - } - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20180827132710.php b/Neos.Flow/Migrations/Mysql/Version20180827132710.php deleted file mode 100644 index 18f450f701..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20180827132710.php +++ /dev/null @@ -1,45 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - $this->addSql('CREATE INDEX IDX_535A651E772E836ADCCB5599802C8F9D ON neos_flow_mvc_routing_objectpathmapping (identifier, uripattern, pathsegment)'); - } - - /** - * @param Schema $schema - * @return void - * @throws \Doctrine\Migrations\Exception\AbortMigration - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - $this->addSql('DROP INDEX IDX_535A651E772E836ADCCB5599802C8F9D ON neos_flow_mvc_routing_objectpathmapping'); - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20200908155620.php b/Neos.Flow/Migrations/Mysql/Version20200908155620.php deleted file mode 100644 index 1d1e37e28f..0000000000 --- a/Neos.Flow/Migrations/Mysql/Version20200908155620.php +++ /dev/null @@ -1,73 +0,0 @@ -abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - $this->addSql('ALTER TABLE neos_flow_resourcemanagement_persistentresource DROP md5'); - } - - /** - * @param Schema $schema - * @return void - * @throws \Doctrine\Migrations\Exception\AbortMigration - * @throws \Doctrine\DBAL\Exception - */ - public function down(Schema $schema): void - { - $this->abortIf(!($this->connection->getDatabasePlatform() instanceof MySQLPlatform), 'Migration can only be executed safely on "mysql".'); - - $this->addSql('ALTER TABLE neos_flow_resourcemanagement_persistentresource ADD md5 VARCHAR(32) NOT NULL'); - } - - /** - * Add md5 content hash for resources. - * - * @param Schema $schema - * @return void - * @throws \Doctrine\DBAL\Exception - */ - public function postDown(Schema $schema): void - { - $resourceRepository = Bootstrap::$staticObjectManager->get(ResourceRepository::class); - $persistenceManager = Bootstrap::$staticObjectManager->get(PersistenceManagerInterface::class); - - $iterator = $resourceRepository->findAllIterator(); - foreach ($iterator as $resource) { - /* @var PersistentResource $resource */ - if (!is_resource($resource->getStream())) { - continue; - } - - $this->connection->executeStatement( - 'UPDATE neos_flow_resourcemanagement_persistentresource SET md5 = ? WHERE persistence_object_identifier = ?', - [md5(stream_get_contents($resource->getStream())), $persistenceManager->getIdentifierByObject($resource)] - ); - } - } -} diff --git a/Neos.Flow/Migrations/Mysql/Version20251021000001.php b/Neos.Flow/Migrations/Mysql/Version20251021000001.php new file mode 100644 index 0000000000..e66e35261d --- /dev/null +++ b/Neos.Flow/Migrations/Mysql/Version20251021000001.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('CREATE TABLE neos_flow_mvc_routing_objectpathmapping (objecttype VARCHAR(255) NOT NULL, uripattern VARCHAR(255) NOT NULL, pathsegment VARCHAR(255) NOT NULL, identifier VARCHAR(255) NOT NULL, INDEX IDX_535A651E772E836ADCCB5599802C8F9D (identifier, uripattern, pathsegment), PRIMARY KEY(objecttype, uripattern, pathsegment)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE neos_flow_resourcemanagement_persistentresource (persistence_object_identifier VARCHAR(40) NOT NULL, collectionname VARCHAR(255) NOT NULL, filename VARCHAR(255) NOT NULL, filesize NUMERIC(20, 0) NOT NULL, relativepublicationpath VARCHAR(255) NOT NULL, mediatype VARCHAR(100) NOT NULL, sha1 VARCHAR(40) NOT NULL, INDEX IDX_35DC14F03332102A (sha1), PRIMARY KEY(persistence_object_identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE neos_flow_security_account (persistence_object_identifier VARCHAR(40) NOT NULL, accountidentifier VARCHAR(255) NOT NULL, authenticationprovidername VARCHAR(255) NOT NULL, credentialssource VARCHAR(255) DEFAULT NULL, creationdate DATETIME NOT NULL, expirationdate DATETIME DEFAULT NULL, lastsuccessfulauthenticationdate DATETIME DEFAULT NULL, failedauthenticationcount INT DEFAULT NULL, roleidentifiers LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:simple_array)\', UNIQUE INDEX flow_identity_neos_flow_security_account (accountidentifier, authenticationprovidername), PRIMARY KEY(persistence_object_identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + } + + 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('DROP TABLE neos_flow_mvc_routing_objectpathmapping'); + $this->addSql('DROP TABLE neos_flow_resourcemanagement_persistentresource'); + $this->addSql('DROP TABLE neos_flow_security_account'); + } +}