]> git.immae.eu Git - github/wallabag/wallabag.git/blame - app/DoctrineMigrations/Version20161122144743.php
Merge pull request #4438 from wallabag/dependabot/composer/scheb/two-factor-bundle...
[github/wallabag/wallabag.git] / app / DoctrineMigrations / Version20161122144743.php
CommitLineData
d64bf795
NL
1<?php
2
3namespace Application\Migrations;
4
d64bf795 5use Doctrine\DBAL\Schema\Schema;
bfe7a692 6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
d64bf795
NL
7
8/**
a4d55a91 9 * Add the restricted_access internal setting for articles with paywall.
d64bf795 10 */
bfe7a692 11class Version20161122144743 extends WallabagMigration
d64bf795 12{
d64bf795
NL
13 public function up(Schema $schema)
14 {
31fec5f3
JB
15 $access = $this->container
16 ->get('doctrine.orm.default_entity_manager')
17 ->getConnection()
f808b016 18 ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'restricted_access'");
31fec5f3
JB
19
20 $this->skipIf(false !== $access, 'It seems that you already played this migration.');
21
f808b016 22 $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('restricted_access', 0, 'entry')");
d64bf795
NL
23 }
24
d64bf795
NL
25 public function down(Schema $schema)
26 {
f808b016
JB
27 $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'restricted_access';");
28 }
d64bf795 29}