From fbefc281370dabcc7e67e45cd1b37a0d31e568e6 Mon Sep 17 00:00:00 2001 From: Marco Perberschlager Date: Fri, 23 Aug 2024 11:49:50 +0200 Subject: [PATCH 1/2] 121 Changed character set for column --- src/Migrations/Version20240823111615.php | 49 ++++++++++++++++++++++++ src/Tools/Installer.php | 6 +-- 2 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 src/Migrations/Version20240823111615.php diff --git a/src/Migrations/Version20240823111615.php b/src/Migrations/Version20240823111615.php new file mode 100644 index 0000000..99ea871 --- /dev/null +++ b/src/Migrations/Version20240823111615.php @@ -0,0 +1,49 @@ +getTable('bundle_outputdataconfigtoolkit_outputdefinition'); + + $query = "ALTER TABLE `%s` CHANGE COLUMN `configuration` `configuration` LONGTEXT + CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin' NULL DEFAULT NULL;"; + + $this->addSql(sprintf($query, $table->getName())); + } + + public function down(Schema $schema): void + { + $table = $schema->getTable('bundle_outputdataconfigtoolkit_outputdefinition'); + + $query = "ALTER TABLE `%s` CHANGE COLUMN `configuration` `configuration` LONGTEXT + CHARACTER SET 'latin1' NULL DEFAULT NULL;"; + + $this->addSql(sprintf($query, $table->getName())); + } +} diff --git a/src/Tools/Installer.php b/src/Tools/Installer.php index 6f544a2..dbbf4df 100644 --- a/src/Tools/Installer.php +++ b/src/Tools/Installer.php @@ -36,8 +36,8 @@ public function install(): void `id` int(11) NOT NULL AUTO_INCREMENT, `objectId` int(11) NOT NULL, `classId` varchar(50) NOT NULL, - `channel` varchar(255) COLLATE utf8_bin NOT NULL, - `configuration` longtext CHARACTER SET latin1, + `channel` varchar(255) NOT NULL, + `configuration` longtext, PRIMARY KEY (`id`), UNIQUE KEY `Unique` (`objectId`,`classId`,`channel`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; @@ -78,7 +78,7 @@ public function uninstall(): void $db->executeQuery('DROP TABLE IF EXISTS `' . Dao::TABLE_NAME . '`;'); $db->executeQuery("DELETE FROM users_permission_definitions WHERE `key` = 'bundle_outputDataConfigToolkit'"); - if (self::isInstalled()) { + if ($this->isInstalled()) { throw new InstallationException('Could not be uninstalled.'); } } From 6c208e32636dadeb2e6b954cff8fb299c7b0d2a6 Mon Sep 17 00:00:00 2001 From: Marco Perberschlager Date: Fri, 23 Aug 2024 11:52:15 +0200 Subject: [PATCH 2/2] 121 Removed unnecessary getTable --- src/Migrations/Version20240823111615.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Migrations/Version20240823111615.php b/src/Migrations/Version20240823111615.php index 99ea871..412cb92 100644 --- a/src/Migrations/Version20240823111615.php +++ b/src/Migrations/Version20240823111615.php @@ -29,21 +29,17 @@ public function getDescription(): string public function up(Schema $schema): void { - $table = $schema->getTable('bundle_outputdataconfigtoolkit_outputdefinition'); - - $query = "ALTER TABLE `%s` CHANGE COLUMN `configuration` `configuration` LONGTEXT + $query = "ALTER TABLE `bundle_outputdataconfigtoolkit_outputdefinition` CHANGE COLUMN `configuration` `configuration` LONGTEXT CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin' NULL DEFAULT NULL;"; - $this->addSql(sprintf($query, $table->getName())); + $this->addSql($query); } public function down(Schema $schema): void { - $table = $schema->getTable('bundle_outputdataconfigtoolkit_outputdefinition'); - - $query = "ALTER TABLE `%s` CHANGE COLUMN `configuration` `configuration` LONGTEXT + $query = "ALTER TABLE `bundle_outputdataconfigtoolkit_outputdefinition` CHANGE COLUMN `configuration` `configuration` LONGTEXT CHARACTER SET 'latin1' NULL DEFAULT NULL;"; - $this->addSql(sprintf($query, $table->getName())); + $this->addSql($query); } }