3 namespace Application\Migrations
;
5 use Doctrine\DBAL\Migrations\AbstractMigration
;
6 use Doctrine\DBAL\Schema\Schema
;
7 use Symfony\Component\DependencyInjection\ContainerAwareInterface
;
8 use Symfony\Component\DependencyInjection\ContainerInterface
;
11 * Remove wallabag_url from craue_config_setting.
12 * It has been moved into the parameters.yml
14 class Version20170606155640
extends AbstractMigration
implements ContainerAwareInterface
17 * @var ContainerInterface
21 public function setContainer(ContainerInterface
$container = null)
23 $this->container
= $container;
26 private function getTable($tableName)
28 return $this->container
->getParameter('database_table_prefix').$tableName;
32 * @param Schema $schema
34 public function up(Schema
$schema)
36 $apiUserRegistration = $this->container
37 ->get('doctrine.orm.default_entity_manager')
39 ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'wallabag_url'");
41 $this->skipIf(false === $apiUserRegistration, 'It seems that you already played this migration.');
43 $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'wallabag_url'");
47 * @param Schema $schema
49 public function down(Schema
$schema)
51 $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('wallabag_url', 'wallabag.me', 'misc')");