Commit 081f4f9b authored by Julien Fastré's avatar Julien Fastré

fix migration name and migrate old data

parent baf4b1f2
......@@ -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');
......
<?php declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Correction: copie les infos de email vers contactInfo.
*
* Previously, data from contact where stored in 'email' column
*/
final class Version20180820120000 extends AbstractMigration
{
public function up(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 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=\'\'');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment