<?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 Version20200424144903 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 country DROP FOREIGN KEY FK_5373C9667D05ABBE');
$this->addSql('DROP INDEX UNIQ_5373C9667D05ABBE ON country');
$this->addSql('ALTER TABLE country DROP tracking_id');
$this->addSql('ALTER TABLE tracking ADD country_id INT DEFAULT NULL, ADD deleted TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE tracking ADD CONSTRAINT FK_A87C621CF92F3E70 FOREIGN KEY (country_id) REFERENCES country (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_A87C621CF92F3E70 ON tracking (country_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 country ADD tracking_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE country ADD CONSTRAINT FK_5373C9667D05ABBE FOREIGN KEY (tracking_id) REFERENCES tracking (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_5373C9667D05ABBE ON country (tracking_id)');
$this->addSql('ALTER TABLE tracking DROP FOREIGN KEY FK_A87C621CF92F3E70');
$this->addSql('DROP INDEX UNIQ_A87C621CF92F3E70 ON tracking');
$this->addSql('ALTER TABLE tracking DROP country_id, DROP deleted');
}
}