mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-15 21:41:06 +00:00
Fix utf8mb4 on vendor tables
When creating the schema for test these tables use default length for string: 255. Which fail when using utf8mb4. > Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes Also move the `setKeepStaticConnections` in before and after class to avoid: > SAVEPOINT DOCTRINE2_SAVEPOINT_2 does not exist See https://github.com/dmaicher/doctrine-test-bundle#troubleshooting
This commit is contained in:
parent
9a8a1bdfdb
commit
877787e5fe
6 changed files with 107 additions and 24 deletions
|
@ -2,26 +2,14 @@
|
||||||
|
|
||||||
namespace Application\Migrations;
|
namespace Application\Migrations;
|
||||||
|
|
||||||
use Doctrine\DBAL\Migrations\AbstractMigration;
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add archived_at column and set its value to updated_at for is_archived entries.
|
* 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
|
* @param Schema $schema
|
||||||
*/
|
*/
|
||||||
|
@ -60,9 +48,4 @@ class Version20180405182455 extends AbstractMigration implements ContainerAwareI
|
||||||
|
|
||||||
$entryTable->dropColumn('archived_at');
|
$entryTable->dropColumn('archived_at');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getTable($tableName)
|
|
||||||
{
|
|
||||||
return $this->container->getParameter('database_table_prefix') . $tableName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
45
app/DoctrineMigrations/Version20181128203230.php
Normal file
45
app/DoctrineMigrations/Version20181128203230.php
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Application\Migrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fix varchar field from vendor to work with utf8mb4.
|
||||||
|
*/
|
||||||
|
class Version20181128203230 extends WallabagMigration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param Schema $schema
|
||||||
|
*/
|
||||||
|
public function up(Schema $schema)
|
||||||
|
{
|
||||||
|
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(191)');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(191) NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(191)');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(191)');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(191)');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(191)');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(191)');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema)
|
||||||
|
{
|
||||||
|
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(255)');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(255) NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(255)');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(255)');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(255)');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(255)');
|
||||||
|
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(255)');
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\AccessToken as BaseAccessToken;
|
||||||
/**
|
/**
|
||||||
* @ORM\Table("oauth2_access_tokens")
|
* @ORM\Table("oauth2_access_tokens")
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
|
* @ORM\AttributeOverrides({
|
||||||
|
* @ORM\AttributeOverride(name="token",
|
||||||
|
* column=@ORM\Column(
|
||||||
|
* name = "token",
|
||||||
|
* type = "string",
|
||||||
|
* length = 191
|
||||||
|
* )
|
||||||
|
* ),
|
||||||
|
* @ORM\AttributeOverride(name="scope",
|
||||||
|
* column=@ORM\Column(
|
||||||
|
* name = "scope",
|
||||||
|
* type = "string",
|
||||||
|
* length = 191
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* })
|
||||||
*/
|
*/
|
||||||
class AccessToken extends BaseAccessToken
|
class AccessToken extends BaseAccessToken
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\AuthCode as BaseAuthCode;
|
||||||
/**
|
/**
|
||||||
* @ORM\Table("oauth2_auth_codes")
|
* @ORM\Table("oauth2_auth_codes")
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
|
* @ORM\AttributeOverrides({
|
||||||
|
* @ORM\AttributeOverride(name="token",
|
||||||
|
* column=@ORM\Column(
|
||||||
|
* name = "token",
|
||||||
|
* type = "string",
|
||||||
|
* length = 191
|
||||||
|
* )
|
||||||
|
* ),
|
||||||
|
* @ORM\AttributeOverride(name="scope",
|
||||||
|
* column=@ORM\Column(
|
||||||
|
* name = "scope",
|
||||||
|
* type = "string",
|
||||||
|
* length = 191
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* })
|
||||||
*/
|
*/
|
||||||
class AuthCode extends BaseAuthCode
|
class AuthCode extends BaseAuthCode
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\RefreshToken as BaseRefreshToken;
|
||||||
/**
|
/**
|
||||||
* @ORM\Table("oauth2_refresh_tokens")
|
* @ORM\Table("oauth2_refresh_tokens")
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
|
* @ORM\AttributeOverrides({
|
||||||
|
* @ORM\AttributeOverride(name="token",
|
||||||
|
* column=@ORM\Column(
|
||||||
|
* name = "token",
|
||||||
|
* type = "string",
|
||||||
|
* length = 191
|
||||||
|
* )
|
||||||
|
* ),
|
||||||
|
* @ORM\AttributeOverride(name="scope",
|
||||||
|
* column=@ORM\Column(
|
||||||
|
* name = "scope",
|
||||||
|
* type = "string",
|
||||||
|
* length = 191
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* })
|
||||||
*/
|
*/
|
||||||
class RefreshToken extends BaseRefreshToken
|
class RefreshToken extends BaseRefreshToken
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,6 +18,18 @@ use Wallabag\CoreBundle\Command\InstallCommand;
|
||||||
|
|
||||||
class InstallCommandTest extends WallabagCoreTestCase
|
class InstallCommandTest extends WallabagCoreTestCase
|
||||||
{
|
{
|
||||||
|
public static function setUpBeforeClass()
|
||||||
|
{
|
||||||
|
// disable doctrine-test-bundle
|
||||||
|
StaticDriver::setKeepStaticConnections(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function tearDownAfterClass()
|
||||||
|
{
|
||||||
|
// enable doctrine-test-bundle
|
||||||
|
StaticDriver::setKeepStaticConnections(true);
|
||||||
|
}
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
@ -51,9 +63,6 @@ class InstallCommandTest extends WallabagCoreTestCase
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable doctrine-test-bundle
|
|
||||||
StaticDriver::setKeepStaticConnections(false);
|
|
||||||
|
|
||||||
$this->resetDatabase($this->getClient());
|
$this->resetDatabase($this->getClient());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,8 +81,6 @@ class InstallCommandTest extends WallabagCoreTestCase
|
||||||
$this->resetDatabase($client);
|
$this->resetDatabase($client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable doctrine-test-bundle
|
|
||||||
StaticDriver::setKeepStaticConnections(true);
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue