aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xapp/DoctrineMigrations/Version20180405182455.php21
-rw-r--r--app/DoctrineMigrations/Version20181128203230.php45
-rw-r--r--src/Wallabag/ApiBundle/Entity/AccessToken.php16
-rw-r--r--src/Wallabag/ApiBundle/Entity/AuthCode.php16
-rw-r--r--src/Wallabag/ApiBundle/Entity/RefreshToken.php16
-rw-r--r--tests/Wallabag/CoreBundle/Command/InstallCommandTest.php17
6 files changed, 107 insertions, 24 deletions
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
3namespace Application\Migrations; 3namespace Application\Migrations;
4 4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema; 5use Doctrine\DBAL\Schema\Schema;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface; 6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
8use 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 */
13class Version20180405182455 extends AbstractMigration implements ContainerAwareInterface 11class 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/Version20181128203230.php b/app/DoctrineMigrations/Version20181128203230.php
new file mode 100644
index 00000000..d1b09fc7
--- /dev/null
+++ b/app/DoctrineMigrations/Version20181128203230.php
@@ -0,0 +1,45 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Fix varchar field from vendor to work with utf8mb4.
10 */
11class Version20181128203230 extends WallabagMigration
12{
13 /**
14 * @param Schema $schema
15 */
16 public function up(Schema $schema)
17 {
18 $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.');
19
20 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL');
21 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(191)');
22 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(191) NOT NULL');
23 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(191)');
24 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL');
25 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(191)');
26 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(191)');
27 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(191)');
28 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(191)');
29 }
30
31 public function down(Schema $schema)
32 {
33 $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.');
34
35 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL');
36 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(255)');
37 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(255) NOT NULL');
38 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(255)');
39 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL');
40 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(255)');
41 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(255)');
42 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(255)');
43 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(255)');
44 }
45}
diff --git a/src/Wallabag/ApiBundle/Entity/AccessToken.php b/src/Wallabag/ApiBundle/Entity/AccessToken.php
index c09a0c80..5e4099dd 100644
--- a/src/Wallabag/ApiBundle/Entity/AccessToken.php
+++ b/src/Wallabag/ApiBundle/Entity/AccessToken.php
@@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\AccessToken as BaseAccessToken;
8/** 8/**
9 * @ORM\Table("oauth2_access_tokens") 9 * @ORM\Table("oauth2_access_tokens")
10 * @ORM\Entity 10 * @ORM\Entity
11 * @ORM\AttributeOverrides({
12 * @ORM\AttributeOverride(name="token",
13 * column=@ORM\Column(
14 * name = "token",
15 * type = "string",
16 * length = 191
17 * )
18 * ),
19 * @ORM\AttributeOverride(name="scope",
20 * column=@ORM\Column(
21 * name = "scope",
22 * type = "string",
23 * length = 191
24 * )
25 * )
26 * })
11 */ 27 */
12class AccessToken extends BaseAccessToken 28class AccessToken extends BaseAccessToken
13{ 29{
diff --git a/src/Wallabag/ApiBundle/Entity/AuthCode.php b/src/Wallabag/ApiBundle/Entity/AuthCode.php
index 4d4b09fe..5fa205ac 100644
--- a/src/Wallabag/ApiBundle/Entity/AuthCode.php
+++ b/src/Wallabag/ApiBundle/Entity/AuthCode.php
@@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\AuthCode as BaseAuthCode;
8/** 8/**
9 * @ORM\Table("oauth2_auth_codes") 9 * @ORM\Table("oauth2_auth_codes")
10 * @ORM\Entity 10 * @ORM\Entity
11 * @ORM\AttributeOverrides({
12 * @ORM\AttributeOverride(name="token",
13 * column=@ORM\Column(
14 * name = "token",
15 * type = "string",
16 * length = 191
17 * )
18 * ),
19 * @ORM\AttributeOverride(name="scope",
20 * column=@ORM\Column(
21 * name = "scope",
22 * type = "string",
23 * length = 191
24 * )
25 * )
26 * })
11 */ 27 */
12class AuthCode extends BaseAuthCode 28class AuthCode extends BaseAuthCode
13{ 29{
diff --git a/src/Wallabag/ApiBundle/Entity/RefreshToken.php b/src/Wallabag/ApiBundle/Entity/RefreshToken.php
index 822a02d8..dd8e9c63 100644
--- a/src/Wallabag/ApiBundle/Entity/RefreshToken.php
+++ b/src/Wallabag/ApiBundle/Entity/RefreshToken.php
@@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\RefreshToken as BaseRefreshToken;
8/** 8/**
9 * @ORM\Table("oauth2_refresh_tokens") 9 * @ORM\Table("oauth2_refresh_tokens")
10 * @ORM\Entity 10 * @ORM\Entity
11 * @ORM\AttributeOverrides({
12 * @ORM\AttributeOverride(name="token",
13 * column=@ORM\Column(
14 * name = "token",
15 * type = "string",
16 * length = 191
17 * )
18 * ),
19 * @ORM\AttributeOverride(name="scope",
20 * column=@ORM\Column(
21 * name = "scope",
22 * type = "string",
23 * length = 191
24 * )
25 * )
26 * })
11 */ 27 */
12class RefreshToken extends BaseRefreshToken 28class RefreshToken extends BaseRefreshToken
13{ 29{
diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
index 08685408..d8928451 100644
--- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
+++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
@@ -18,6 +18,18 @@ use Wallabag\CoreBundle\Command\InstallCommand;
18 18
19class InstallCommandTest extends WallabagCoreTestCase 19class InstallCommandTest extends WallabagCoreTestCase
20{ 20{
21 public static function setUpBeforeClass()
22 {
23 // disable doctrine-test-bundle
24 StaticDriver::setKeepStaticConnections(false);
25 }
26
27 public static function tearDownAfterClass()
28 {
29 // enable doctrine-test-bundle
30 StaticDriver::setKeepStaticConnections(true);
31 }
32
21 public function setUp() 33 public function setUp()
22 { 34 {
23 parent::setUp(); 35 parent::setUp();
@@ -51,9 +63,6 @@ class InstallCommandTest extends WallabagCoreTestCase
51 parent::setUp(); 63 parent::setUp();
52 } 64 }
53 65
54 // disable doctrine-test-bundle
55 StaticDriver::setKeepStaticConnections(false);
56
57 $this->resetDatabase($this->getClient()); 66 $this->resetDatabase($this->getClient());
58 } 67 }
59 68
@@ -72,8 +81,6 @@ class InstallCommandTest extends WallabagCoreTestCase
72 $this->resetDatabase($client); 81 $this->resetDatabase($client);
73 } 82 }
74 83
75 // enable doctrine-test-bundle
76 StaticDriver::setKeepStaticConnections(true);
77 parent::tearDown(); 84 parent::tearDown();
78 } 85 }
79 86