Skip to content

Commit

Permalink
121 Changed character set for column
Browse files Browse the repository at this point in the history
  • Loading branch information
mcop1 committed Aug 23, 2024
1 parent 8c8618f commit fbefc28
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
49 changes: 49 additions & 0 deletions src/Migrations/Version20240823111615.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

declare(strict_types=1);

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace OutputDataConfigToolkitBundle\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20240823111615 extends AbstractMigration
{
public function getDescription(): string
{
return 'Migrate bundle_outputdataconfigtoolkit_outputdefinition table columns';
}

public function up(Schema $schema): void
{
$table = $schema->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()));
}
}
6 changes: 3 additions & 3 deletions src/Tools/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.');
}
}
Expand Down

0 comments on commit fbefc28

Please sign in to comment.