<?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 Version20170120154610 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 country');
$this->addSql('DROP INDEX FK_12E633E6F92F3E70 ON hoard');
$this->addSql('ALTER TABLE hoard DROP country_id, DROP description, CHANGE reference_string reference_string LONGTEXT DEFAULT NULL, CHANGE credit credit LONGTEXT DEFAULT NULL');
}
/**
* @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 DROP FOREIGN KEY FK_12E633E6E946114A');
$this->addSql('DROP INDEX IDX_12E633E6E946114A ON hoard');
$this->addSql('ALTER TABLE hoard ADD country_id INT DEFAULT NULL, ADD description VARCHAR(255) DEFAULT NULL, CHANGE reference_string reference_string VARCHAR(255) DEFAULT NULL, CHANGE credit credit VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE hoard ADD CONSTRAINT country FOREIGN KEY (country_id) REFERENCES country (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
}
}