mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix migration name and migrate old data
This commit is contained in:
parent
baf4b1f277
commit
081f4f9b4c
@ -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');
|
31
Resources/migrations/Version20180820120000.php
Normal file
31
Resources/migrations/Version20180820120000.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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=\'\'');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user