From d6c4c484c46706f9eecf81af3f64649f014418e1 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 6 Jun 2017 16:04:51 +0200 Subject: add migration --- app/DoctrineMigrations/Version20170606155640.php | 52 ++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 app/DoctrineMigrations/Version20170606155640.php (limited to 'app/DoctrineMigrations/Version20170606155640.php') diff --git a/app/DoctrineMigrations/Version20170606155640.php b/app/DoctrineMigrations/Version20170606155640.php new file mode 100644 index 00000000..1b234044 --- /dev/null +++ b/app/DoctrineMigrations/Version20170606155640.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) + { + $apiUserRegistration = $this->container + ->get('doctrine.orm.default_entity_manager') + ->getConnection() + ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'wallabag_url'"); + + $this->skipIf(false === $apiUserRegistration, 'It seems that you already played this migration.'); + + $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'wallabag_url'"); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('wallabag_url', 'wallabag.me', 'misc')"); + } +} -- cgit v1.2.3 From 80f4d85ac92ab4dc490c51f2d831ac7fa3853826 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 8 Jun 2017 19:15:33 +0200 Subject: Review --- app/DoctrineMigrations/Version20170606155640.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/DoctrineMigrations/Version20170606155640.php') diff --git a/app/DoctrineMigrations/Version20170606155640.php b/app/DoctrineMigrations/Version20170606155640.php index 1b234044..e9b50428 100644 --- a/app/DoctrineMigrations/Version20170606155640.php +++ b/app/DoctrineMigrations/Version20170606155640.php @@ -8,7 +8,8 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Add api_user_registration in craue_config_setting. + * Remove wallabag_url from craue_config_setting. + * It has been moved into the parameters.yml */ class Version20170606155640 extends AbstractMigration implements ContainerAwareInterface { -- cgit v1.2.3