<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
#use Doctrine\Migrations\AbstractMigration;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20200106093025 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
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 residence ADD infos_residence_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE residence ADD CONSTRAINT FK_32758237E773F7D FOREIGN KEY (infos_residence_id) REFERENCES infos_residence (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_32758237E773F7D ON residence (infos_residence_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 residence DROP FOREIGN KEY FK_32758237E773F7D');
$this->addSql('DROP INDEX UNIQ_32758237E773F7D ON residence');
$this->addSql('ALTER TABLE residence DROP infos_residence_id');
}
}