<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20170217113835 extends AbstractMigration
{
/**
* @param Schema $schema
*/
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 hoard DROP FOREIGN KEY archaeology_rating');
$this->addSql('ALTER TABLE hoard DROP archaeology_rating_id, DROP closing_year1, DROP closing_year2');
$this->addSql('ALTER TABLE hoard_audit DROP archaeology_rating_id, DROP closing_year1, DROP closing_year2');
}
/**
* @param Schema $schema
*/
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 hoard ADD archaeology_rating_id INT DEFAULT NULL, ADD closing_year1 INT DEFAULT NULL, ADD closing_year2 INT DEFAULT NULL');
$this->addSql('ALTER TABLE hoard ADD CONSTRAINT archaeology_rating FOREIGN KEY (archaeology_rating_id) REFERENCES rating (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('CREATE INDEX FK_12E633E6D37CEDD0 ON hoard (archaeology_rating_id)');
$this->addSql('ALTER TABLE hoard_audit ADD archaeology_rating_id INT DEFAULT NULL, ADD closing_year1 INT DEFAULT NULL, ADD closing_year2 INT DEFAULT NULL');
}
}