From 081f4f9b4c0923dacd4dd5c433f4fa3218020b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 20 Aug 2018 21:33:59 +0200 Subject: [PATCH] fix migration name and migrate old data --- ...81442210.php => Version20180518144221.php} | 2 -- .../migrations/Version20180820120000.php | 31 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) rename Resources/migrations/{Version201805181442210.php => Version20180518144221.php} (88%) create mode 100644 Resources/migrations/Version20180820120000.php diff --git a/Resources/migrations/Version201805181442210.php b/Resources/migrations/Version20180518144221.php similarity index 88% rename from Resources/migrations/Version201805181442210.php rename to Resources/migrations/Version20180518144221.php index 74d9c64c3..f1ac50961 100644 --- a/Resources/migrations/Version201805181442210.php +++ b/Resources/migrations/Version20180518144221.php @@ -12,7 +12,6 @@ final class Version20180518144221 extends AbstractMigration { public function up(Schema $schema) : void { - // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); $this->addSql('ALTER TABLE chill_person_person ADD contactInfo TEXT DEFAULT NULL'); @@ -22,7 +21,6 @@ final class Version20180518144221 extends AbstractMigration public function down(Schema $schema) : void { - // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); $this->addSql('ALTER TABLE chill_person_person DROP contactInfo'); diff --git a/Resources/migrations/Version20180820120000.php b/Resources/migrations/Version20180820120000.php new file mode 100644 index 000000000..04f132668 --- /dev/null +++ b/Resources/migrations/Version20180820120000.php @@ -0,0 +1,31 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('UPDATE chill_person_person SET contactInfo=email'); + $this->addSql('UPDATE chill_person_person SET email=\'\''); + + } + + public function down(Schema $schema) : void + { + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); + + $this->addSql('UPDATE chill_person_person SET email=contactInfo'); + $this->addSql('UPDATE chill_person_person SET contactInfo=\'\''); + } +}