diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2018-10-29 14:33:41 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2018-10-29 14:33:41 +0100 |
commit | 48c802da124ccb44f9602ae05af3bf1d2082a8d0 (patch) | |
tree | e3c1d7acf3cc9ac9582880210671c6253928af77 | |
parent | 2e1c165316102a622f6f57bcb3422aaa76962043 (diff) | |
download | wallabag-48c802da124ccb44f9602ae05af3bf1d2082a8d0.tar.gz wallabag-48c802da124ccb44f9602ae05af3bf1d2082a8d0.tar.zst wallabag-48c802da124ccb44f9602ae05af3bf1d2082a8d0.zip |
fixup! Debug MySQL failing
-rw-r--r-- | app/DoctrineMigrations/Version20160401000000.php | 2 | ||||
-rwxr-xr-x | app/DoctrineMigrations/Version20180405182455.php | 21 | ||||
-rw-r--r-- | app/DoctrineMigrations/Version20181029131313.php | 38 | ||||
-rw-r--r-- | app/config/config.yml | 3 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/InternalSetting.php | 36 | ||||
-rw-r--r-- | tests/Wallabag/CoreBundle/WallabagCoreTestCase.php | 10 |
6 files changed, 86 insertions, 24 deletions
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 | |||
63 | break; | 63 | break; |
64 | case 'mysql': | 64 | case 'mysql': |
65 | $sql = <<<SQL | 65 | $sql = <<<SQL |
66 | 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; | 66 | 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; |
67 | 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; | 67 | 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; |
68 | 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; | 68 | 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; |
69 | 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; | 69 | 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,27 +2,15 @@ | |||
2 | 2 | ||
3 | namespace Application\Migrations; | 3 | namespace Application\Migrations; |
4 | 4 | ||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; | ||
6 | use Doctrine\DBAL\Schema\Schema; | 5 | use Doctrine\DBAL\Schema\Schema; |
7 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | 6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; |
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | ||
9 | 7 | ||
10 | /** | 8 | /** |
11 | * Add archived_at column and set its value to updated_at for is_archived entries. | 9 | * Add archived_at column and set its value to updated_at for is_archived entries. |
12 | */ | 10 | */ |
13 | class Version20180405182455 extends AbstractMigration implements ContainerAwareInterface | 11 | class Version20180405182455 extends WallabagMigration |
14 | { | 12 | { |
15 | /** | 13 | /** |
16 | * @var ContainerInterface | ||
17 | */ | ||
18 | private $container; | ||
19 | |||
20 | public function setContainer(ContainerInterface $container = null) | ||
21 | { | ||
22 | $this->container = $container; | ||
23 | } | ||
24 | |||
25 | /** | ||
26 | * @param Schema $schema | 14 | * @param Schema $schema |
27 | */ | 15 | */ |
28 | public function up(Schema $schema) | 16 | public function up(Schema $schema) |
@@ -60,9 +48,4 @@ class Version20180405182455 extends AbstractMigration implements ContainerAwareI | |||
60 | 48 | ||
61 | $entryTable->dropColumn('archived_at'); | 49 | $entryTable->dropColumn('archived_at'); |
62 | } | 50 | } |
63 | |||
64 | private function getTable($tableName) | ||
65 | { | ||
66 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
67 | } | ||
68 | } | 51 | } |
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 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Application\Migrations; | ||
6 | |||
7 | use Doctrine\DBAL\Schema\Schema; | ||
8 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
9 | |||
10 | /** | ||
11 | * Force utf8mb4 on craue_config_setting. | ||
12 | */ | ||
13 | final class Version20181029131313 extends WallabagMigration | ||
14 | { | ||
15 | public function up(Schema $schema): void | ||
16 | { | ||
17 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' RENAME TO ' . $this->getTable('internal_setting') . ';'); | ||
18 | |||
19 | if ('mysql' === $this->connection->getDatabasePlatform()->getName()) { | ||
20 | $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | ||
21 | |||
22 | $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' CHANGE `name` `name` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | ||
23 | $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' CHANGE `section` `section` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); | ||
24 | } | ||
25 | } | ||
26 | |||
27 | public function down(Schema $schema): void | ||
28 | { | ||
29 | $this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' RENAME TO ' . $this->getTable('craue_config_setting') . ';'); | ||
30 | |||
31 | if ('mysql' === $this->connection->getDatabasePlatform()->getName()) { | ||
32 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | ||
33 | |||
34 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | ||
35 | $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); | ||
36 | } | ||
37 | } | ||
38 | } | ||
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: | |||
365 | sensio_framework_extra: | 365 | sensio_framework_extra: |
366 | router: | 366 | router: |
367 | annotations: false | 367 | annotations: false |
368 | |||
369 | craue_config: | ||
370 | 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 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Entity; | ||
4 | |||
5 | use Craue\ConfigBundle\Entity\BaseSetting; | ||
6 | use Doctrine\ORM\Mapping as ORM; | ||
7 | |||
8 | /** | ||
9 | * Internal Setting. | ||
10 | * | ||
11 | * @ORM\Entity(repositoryClass="Craue\ConfigBundle\Repository\SettingRepository") | ||
12 | * @ORM\Table(name="internal_setting") | ||
13 | * @ORM\AttributeOverrides({ | ||
14 | * @ORM\AttributeOverride(name="name", | ||
15 | * column=@ORM\Column( | ||
16 | * name = "name", | ||
17 | * length = 191 | ||
18 | * ) | ||
19 | * ), | ||
20 | * @ORM\AttributeOverride(name="section", | ||
21 | * column=@ORM\Column( | ||
22 | * name = "section", | ||
23 | * length = 191 | ||
24 | * ) | ||
25 | * ) | ||
26 | * }) | ||
27 | */ | ||
28 | class InternalSetting extends BaseSetting | ||
29 | { | ||
30 | /** | ||
31 | * @var string|null | ||
32 | * | ||
33 | * @ORM\Column(name="value", type="string", nullable=true, length=191) | ||
34 | */ | ||
35 | protected $value; | ||
36 | } | ||
diff --git a/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php b/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php index 50361039..7db9fca1 100644 --- a/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php +++ b/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php | |||
@@ -8,7 +8,6 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | |||
8 | use Symfony\Component\BrowserKit\Cookie; | 8 | use Symfony\Component\BrowserKit\Cookie; |
9 | use Symfony\Component\Console\Input\ArrayInput; | 9 | use Symfony\Component\Console\Input\ArrayInput; |
10 | use Symfony\Component\Console\Output\BufferedOutput; | 10 | use Symfony\Component\Console\Output\BufferedOutput; |
11 | use Symfony\Component\Console\Output\NullOutput; | ||
12 | use Wallabag\CoreBundle\Entity\Config; | 11 | use Wallabag\CoreBundle\Entity\Config; |
13 | use Wallabag\UserBundle\Entity\User; | 12 | use Wallabag\UserBundle\Entity\User; |
14 | 13 | ||
@@ -51,7 +50,8 @@ abstract class WallabagCoreTestCase extends WebTestCase | |||
51 | 50 | ||
52 | if (0 !== $exitCode) { | 51 | if (0 !== $exitCode) { |
53 | var_dump('doctrine:schema:drop'); | 52 | var_dump('doctrine:schema:drop'); |
54 | var_export($output->fetch()); die(); | 53 | var_export($output->fetch()); |
54 | die(); | ||
55 | } | 55 | } |
56 | 56 | ||
57 | $output = new BufferedOutput(); | 57 | $output = new BufferedOutput(); |
@@ -63,7 +63,8 @@ abstract class WallabagCoreTestCase extends WebTestCase | |||
63 | 63 | ||
64 | if (0 !== $exitCode) { | 64 | if (0 !== $exitCode) { |
65 | var_dump('doctrine:schema:create'); | 65 | var_dump('doctrine:schema:create'); |
66 | var_export($output->fetch()); die(); | 66 | var_export($output->fetch()); |
67 | die(); | ||
67 | } | 68 | } |
68 | 69 | ||
69 | $output = new BufferedOutput(); | 70 | $output = new BufferedOutput(); |
@@ -75,7 +76,8 @@ abstract class WallabagCoreTestCase extends WebTestCase | |||
75 | 76 | ||
76 | if (0 !== $exitCode) { | 77 | if (0 !== $exitCode) { |
77 | var_dump('doctrine:fixtures:load'); | 78 | var_dump('doctrine:fixtures:load'); |
78 | var_export($output->fetch()); die(); | 79 | var_export($output->fetch()); |
80 | die(); | ||
79 | } | 81 | } |
80 | 82 | ||
81 | /* | 83 | /* |