From: Nicolas LÅ“uillet Date: Thu, 20 Apr 2017 13:45:43 +0000 (+0200) Subject: Cleaned craue_config_setting by removing useless download_pictures setting X-Git-Tag: 2.3.0~31^2~117^2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;ds=sidebyside;h=21d955f7037930bef43d58398395a69b68e3b878;p=github%2Fwallabag%2Fwallabag.git Cleaned craue_config_setting by removing useless download_pictures setting --- diff --git a/app/DoctrineMigrations/Version20170420134133.php b/app/DoctrineMigrations/Version20170420134133.php new file mode 100644 index 00000000..b1ab7bcb --- /dev/null +++ b/app/DoctrineMigrations/Version20170420134133.php @@ -0,0 +1,52 @@ +container = $container; + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix').$tableName; + } + + /** + * @param Schema $schema + */ + public function up(Schema $schema) + { + $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_pictures';"); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $downloadPictures = $this->container + ->get('doctrine.orm.default_entity_manager') + ->getConnection() + ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_pictures'"); + + $this->skipIf(false !== $downloadPictures, 'It seems that you already played this migration.'); + + $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('download_pictures', '1', 'entry')"); + } +}