From 21d955f7037930bef43d58398395a69b68e3b878 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 20 Apr 2017 15:45:43 +0200 Subject: [PATCH] Cleaned craue_config_setting by removing useless download_pictures setting --- .../Version20170420134133.php | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 app/DoctrineMigrations/Version20170420134133.php 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')"); + } +} -- 2.41.0