]> git.immae.eu Git - github/wallabag/wallabag.git/blame - app/DoctrineMigrations/Version20161128084725.php
Fix tests
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20161128084725.php
CommitLineData
9f01d0fd
NL
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface;
9
10/**
9aa99128 11 * Added list_mode in user config.
9f01d0fd
NL
12 */
13class Version20161128084725 extends AbstractMigration implements ContainerAwareInterface
14{
15 /**
16 * @var ContainerInterface
17 */
18 private $container;
19
20 public function setContainer(ContainerInterface $container = null)
21 {
22 $this->container = $container;
23 }
24
9f01d0fd
NL
25 /**
26 * @param Schema $schema
27 */
28 public function up(Schema $schema)
29 {
30 $configTable = $schema->getTable($this->getTable('config'));
9aa99128 31 $this->skipIf($configTable->hasColumn('list_mode'), 'It seems that you already played this migration.');
9f01d0fd 32
24879db1 33 $configTable->addColumn('list_mode', 'integer', ['notnull' => false]);
9f01d0fd
NL
34 }
35
36 /**
37 * @param Schema $schema
38 */
39 public function down(Schema $schema)
40 {
41 $configTable = $schema->getTable($this->getTable('config'));
9aa99128 42 $configTable->dropColumn('list_mode');
9f01d0fd 43 }
f808b016
JB
44
45 private function getTable($tableName)
46 {
47 return $this->container->getParameter('database_table_prefix') . $tableName;
48 }
9f01d0fd 49}