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;
27 * @param Schema $schema
29 public function up(Schema
$schema)
31 $apiUserRegistration = $this->container
32 ->get('doctrine.orm.default_entity_manager')
34 ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'");
36 $this->skipIf(false === $apiUserRegistration, 'It seems that you already played this migration.');
38 $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'");
42 * @param Schema $schema
44 public function down(Schema
$schema)
46 $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('wallabag_url', 'wallabag.me', 'misc')");
49 private function getTable($tableName)
51 return $this->container
->getParameter('database_table_prefix') . $tableName;