]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
fixup! Debug MySQL failing
authorJeremy Benoist <jeremy.benoist@gmail.com>
Mon, 29 Oct 2018 13:33:41 +0000 (14:33 +0100)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Mon, 29 Oct 2018 13:33:41 +0000 (14:33 +0100)
app/DoctrineMigrations/Version20160401000000.php
app/DoctrineMigrations/Version20180405182455.php
app/DoctrineMigrations/Version20181029131313.php [new file with mode: 0644]
app/config/config.yml
src/Wallabag/CoreBundle/Entity/InternalSetting.php [new file with mode: 0644]
tests/Wallabag/CoreBundle/WallabagCoreTestCase.php

index c80e3e1f53cc28df08b58a6f992756d951ca3a04..9a6aeed602baffacaf95e0bf07ff51c7bb0030e5 100644 (file)
@@ -63,7 +63,7 @@ SQL
                 break;
             case 'mysql':
                 $sql = <<<SQL
-CREATE TABLE {$this->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;
index 71879c0ea57350fb4634c11c737578f122bc593c..50fe97c76e44194939c446bc8eba19487cf2b6a9 100755 (executable)
@@ -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 (file)
index 0000000..328dc80
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Application\Migrations;
+
+use Doctrine\DBAL\Schema\Schema;
+use Wallabag\CoreBundle\Doctrine\WallabagMigration;
+
+/**
+ * Force utf8mb4 on craue_config_setting.
+ */
+final class Version20181029131313 extends WallabagMigration
+{
+    public function up(Schema $schema): void
+    {
+        $this->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;');
+        }
+    }
+}
index 092f3ec04860f342aecbfffb607252a45d168c80..b2ab00926a57bae9b3e3af6ba33cccfcf8faf381 100644 (file)
@@ -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 (file)
index 0000000..419a277
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+
+namespace Wallabag\CoreBundle\Entity;
+
+use Craue\ConfigBundle\Entity\BaseSetting;
+use Doctrine\ORM\Mapping as ORM;
+
+/**
+ * Internal Setting.
+ *
+ * @ORM\Entity(repositoryClass="Craue\ConfigBundle\Repository\SettingRepository")
+ * @ORM\Table(name="internal_setting")
+ * @ORM\AttributeOverrides({
+ *      @ORM\AttributeOverride(name="name",
+ *          column=@ORM\Column(
+ *              name     = "name",
+ *              length   = 191
+ *          )
+ *      ),
+ *      @ORM\AttributeOverride(name="section",
+ *          column=@ORM\Column(
+ *              name     = "section",
+ *              length   = 191
+ *          )
+ *      )
+ * })
+ */
+class InternalSetting extends BaseSetting
+{
+    /**
+     * @var string|null
+     *
+     * @ORM\Column(name="value", type="string", nullable=true, length=191)
+     */
+    protected $value;
+}
index 50361039ebd14a3f8d7e36f3bb0cf8f595aec5a1..7db9fca1420c1f955863a08b89a5e419484af27d 100644 (file)
@@ -8,7 +8,6 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
 use Symfony\Component\BrowserKit\Cookie;
 use Symfony\Component\Console\Input\ArrayInput;
 use Symfony\Component\Console\Output\BufferedOutput;
-use Symfony\Component\Console\Output\NullOutput;
 use Wallabag\CoreBundle\Entity\Config;
 use Wallabag\UserBundle\Entity\User;
 
@@ -51,7 +50,8 @@ abstract class WallabagCoreTestCase extends WebTestCase
 
         if (0 !== $exitCode) {
             var_dump('doctrine:schema:drop');
-            var_export($output->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();
         }
 
         /*