aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/DoctrineMigrations/Version20161128084725.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-28 11:02:10 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-28 14:27:58 +0100
commit9f01d0fde09fa055a7db9f26e77c5e6b3d6c2224 (patch)
treec8f043dde3a6bdd653aac7136d742f6ed8c49b84 /app/DoctrineMigrations/Version20161128084725.php
parent34ea7be6228c633ef8da703994eed034026e9c18 (diff)
downloadwallabag-9f01d0fde09fa055a7db9f26e77c5e6b3d6c2224.tar.gz
wallabag-9f01d0fde09fa055a7db9f26e77c5e6b3d6c2224.tar.zst
wallabag-9f01d0fde09fa055a7db9f26e77c5e6b3d6c2224.zip
Added list view
Diffstat (limited to 'app/DoctrineMigrations/Version20161128084725.php')
-rw-r--r--app/DoctrineMigrations/Version20161128084725.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/app/DoctrineMigrations/Version20161128084725.php b/app/DoctrineMigrations/Version20161128084725.php
new file mode 100644
index 00000000..347a4256
--- /dev/null
+++ b/app/DoctrineMigrations/Version20161128084725.php
@@ -0,0 +1,49 @@
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/**
11 * Added view_mode in user config.
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
25 private function getTable($tableName)
26 {
27 return $this->container->getParameter('database_table_prefix').$tableName;
28 }
29
30 /**
31 * @param Schema $schema
32 */
33 public function up(Schema $schema)
34 {
35 $configTable = $schema->getTable($this->getTable('config'));
36 $this->skipIf($configTable->hasColumn('view_mode'), 'It seems that you already played this migration.');
37
38 $configTable->addColumn('view_mode', 'integer');
39 }
40
41 /**
42 * @param Schema $schema
43 */
44 public function down(Schema $schema)
45 {
46 $configTable = $schema->getTable($this->getTable('config'));
47 $configTable->dropColumn('view_mode');
48 }
49}