api/src/Migrations/Version20200307112540.php
<?php declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200307112540 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() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE mass_person ADD user_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE mass_person ADD CONSTRAINT FK_75908575A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_75908575A76ED395 ON mass_person (user_id)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE mass_person DROP FOREIGN KEY FK_75908575A76ED395');
$this->addSql('DROP INDEX UNIQ_75908575A76ED395 ON mass_person');
$this->addSql('ALTER TABLE mass_person DROP user_id');
}
}