]> git.immae.eu Git - github/wallabag/wallabag.git/blame - app/DoctrineMigrations/Version20160812120952.php
Added information about latest migrations
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20160812120952.php
CommitLineData
9c545fe0
TC
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema;
ad9304cd
JB
7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface;
9c545fe0 9
b87f1712
NL
10/**
11 * Added name field on wallabag_oauth2_clients
12 */
ad9304cd 13class Version20160812120952 extends AbstractMigration implements ContainerAwareInterface
9c545fe0 14{
ad9304cd
JB
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 {
18d7bc3a 27 return $this->container->getParameter('database_table_prefix').$tableName;
ad9304cd
JB
28 }
29
9c545fe0
TC
30 /**
31 * @param Schema $schema
32 */
33 public function up(Schema $schema)
34 {
597755b8
NL
35 $clientsTable = $schema->getTable($this->getTable('oauth2_clients'));
36 $this->skipIf($clientsTable->hasColumn('name'), 'It seems that you already played this migration.');
18d7bc3a 37
597755b8 38 $clientsTable->addColumn('name', 'blob');
9c545fe0
TC
39 }
40
41 /**
42 * @param Schema $schema
43 */
44 public function down(Schema $schema)
45 {
597755b8
NL
46 $clientsTable = $schema->getTable($this->getTable('oauth2_clients'));
47 $clientsTable->dropColumn('name');
9c545fe0
TC
48 }
49}