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
*/
$entryTable->dropColumn('archived_at');
}
-
- private function getTable($tableName)
- {
- return $this->container->getParameter('database_table_prefix') . $tableName;
- }
}
--- /dev/null
+<?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)');
+ }
+}
/**
* @ORM\Table("oauth2_access_tokens")
* @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
{
/**
* @ORM\Table("oauth2_auth_codes")
* @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
{
/**
* @ORM\Table("oauth2_refresh_tokens")
* @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 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()
{
parent::setUp();
parent::setUp();
}
- // disable doctrine-test-bundle
- StaticDriver::setKeepStaticConnections(false);
-
$this->resetDatabase($this->getClient());
}
$this->resetDatabase($client);
}
- // enable doctrine-test-bundle
- StaticDriver::setKeepStaticConnections(true);
parent::tearDown();
}