diff options
Diffstat (limited to 'app/DoctrineMigrations/Version20161106113822.php')
-rw-r--r-- | app/DoctrineMigrations/Version20161106113822.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/app/DoctrineMigrations/Version20161106113822.php b/app/DoctrineMigrations/Version20161106113822.php new file mode 100644 index 00000000..41e64a4a --- /dev/null +++ b/app/DoctrineMigrations/Version20161106113822.php | |||
@@ -0,0 +1,42 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; | ||
6 | use Doctrine\DBAL\Schema\Schema; | ||
7 | |||
8 | class Version20161106113822 extends AbstractMigration | ||
9 | { | ||
10 | /** | ||
11 | * @var ContainerInterface | ||
12 | */ | ||
13 | private $container; | ||
14 | |||
15 | public function setContainer(ContainerInterface $container = null) | ||
16 | { | ||
17 | $this->container = $container; | ||
18 | } | ||
19 | |||
20 | private function getTable($tableName) | ||
21 | { | ||
22 | return $this->container->getParameter('database_table_prefix') . $tableName; | ||
23 | } | ||
24 | |||
25 | /** | ||
26 | * @param Schema $schema | ||
27 | */ | ||
28 | public function up(Schema $schema) | ||
29 | { | ||
30 | $this->addSql('ALTER TABLE "'.$this->getTable('config').'" ADD action_mark_as_read INT DEFAULT 0'); | ||
31 | } | ||
32 | |||
33 | /** | ||
34 | * @param Schema $schema | ||
35 | */ | ||
36 | public function down(Schema $schema) | ||
37 | { | ||
38 | $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'This down migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.'); | ||
39 | |||
40 | $this->addSql('ALTER TABLE "'.$this->getTable('config').'" DROP action_mark_as_read'); | ||
41 | } | ||
42 | } | ||