From 48c802da124ccb44f9602ae05af3bf1d2082a8d0 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 29 Oct 2018 14:33:41 +0100 Subject: [PATCH] fixup! Debug MySQL failing --- .../Version20160401000000.php | 2 +- .../Version20180405182455.php | 21 +--------- .../Version20181029131313.php | 38 +++++++++++++++++++ app/config/config.yml | 3 ++ .../CoreBundle/Entity/InternalSetting.php | 36 ++++++++++++++++++ .../CoreBundle/WallabagCoreTestCase.php | 10 +++-- 6 files changed, 86 insertions(+), 24 deletions(-) create mode 100644 app/DoctrineMigrations/Version20181029131313.php create mode 100644 src/Wallabag/CoreBundle/Entity/InternalSetting.php diff --git a/app/DoctrineMigrations/Version20160401000000.php b/app/DoctrineMigrations/Version20160401000000.php index c80e3e1f..9a6aeed6 100644 --- a/app/DoctrineMigrations/Version20160401000000.php +++ b/app/DoctrineMigrations/Version20160401000000.php @@ -63,7 +63,7 @@ SQL break; case 'mysql': $sql = <<getTable('craue_config_setting')} (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_5D9649505E237E06 (name), PRIMARY KEY(name)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; +CREATE TABLE {$this->getTable('craue_config_setting')} (name VARCHAR(191) NOT NULL, value VARCHAR(191) DEFAULT NULL, section VARCHAR(191) DEFAULT NULL, UNIQUE INDEX UNIQ_5D9649505E237E06 (name), PRIMARY KEY(name)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; CREATE TABLE {$this->getTable('entry')} (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, title LONGTEXT DEFAULT NULL, url LONGTEXT DEFAULT NULL, is_archived TINYINT(1) NOT NULL, is_starred TINYINT(1) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype LONGTEXT DEFAULT NULL, language LONGTEXT DEFAULT NULL, reading_time INT DEFAULT NULL, domain_name LONGTEXT DEFAULT NULL, preview_picture LONGTEXT DEFAULT NULL, is_public TINYINT(1) DEFAULT '0', INDEX IDX_F4D18282A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; CREATE TABLE {$this->getTable('entry_tag')} (entry_id INT NOT NULL, tag_id INT NOT NULL, INDEX IDX_C9F0DD7CBA364942 (entry_id), INDEX IDX_C9F0DD7CBAD26311 (tag_id), PRIMARY KEY(entry_id, tag_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; CREATE TABLE {$this->getTable('config')} (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INT NOT NULL, language VARCHAR(255) NOT NULL, rss_token VARCHAR(255) DEFAULT NULL, rss_limit INT DEFAULT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, UNIQUE INDEX UNIQ_87E64C53A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; diff --git a/app/DoctrineMigrations/Version20180405182455.php b/app/DoctrineMigrations/Version20180405182455.php index 71879c0e..50fe97c7 100755 --- a/app/DoctrineMigrations/Version20180405182455.php +++ b/app/DoctrineMigrations/Version20180405182455.php @@ -2,26 +2,14 @@ namespace Application\Migrations; -use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Wallabag\CoreBundle\Doctrine\WallabagMigration; /** * Add archived_at column and set its value to updated_at for is_archived entries. */ -class Version20180405182455 extends AbstractMigration implements ContainerAwareInterface +class Version20180405182455 extends WallabagMigration { - /** - * @var ContainerInterface - */ - private $container; - - public function setContainer(ContainerInterface $container = null) - { - $this->container = $container; - } - /** * @param Schema $schema */ @@ -60,9 +48,4 @@ class Version20180405182455 extends AbstractMigration implements ContainerAwareI $entryTable->dropColumn('archived_at'); } - - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix') . $tableName; - } } diff --git a/app/DoctrineMigrations/Version20181029131313.php b/app/DoctrineMigrations/Version20181029131313.php new file mode 100644 index 00000000..328dc80e --- /dev/null +++ b/app/DoctrineMigrations/Version20181029131313.php @@ -0,0 +1,38 @@ +addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' RENAME TO ' . $this->getTable('internal_setting') . ';'); + + if ('mysql' === $this->connection->getDatabasePlatform()->getName()) { + $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + + $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' CHANGE `name` `name` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' CHANGE `section` `section` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + } + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' RENAME TO ' . $this->getTable('craue_config_setting') . ';'); + + if ('mysql' === $this->connection->getDatabasePlatform()->getName()) { + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); + } + } +} diff --git a/app/config/config.yml b/app/config/config.yml index 092f3ec0..b2ab0092 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -365,3 +365,6 @@ jms_serializer: sensio_framework_extra: router: annotations: false + +craue_config: + entity_name: Wallabag\CoreBundle\Entity\InternalSetting diff --git a/src/Wallabag/CoreBundle/Entity/InternalSetting.php b/src/Wallabag/CoreBundle/Entity/InternalSetting.php new file mode 100644 index 00000000..419a2778 --- /dev/null +++ b/src/Wallabag/CoreBundle/Entity/InternalSetting.php @@ -0,0 +1,36 @@ +fetch()); die(); + var_export($output->fetch()); + die(); } $output = new BufferedOutput(); @@ -63,7 +63,8 @@ abstract class WallabagCoreTestCase extends WebTestCase if (0 !== $exitCode) { var_dump('doctrine:schema:create'); - var_export($output->fetch()); die(); + var_export($output->fetch()); + die(); } $output = new BufferedOutput(); @@ -75,7 +76,8 @@ abstract class WallabagCoreTestCase extends WebTestCase if (0 !== $exitCode) { var_dump('doctrine:fixtures:load'); - var_export($output->fetch()); die(); + var_export($output->fetch()); + die(); } /* -- 2.41.0