<?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 Version20200513091758 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('CREATE TABLE ancient_place (id INT AUTO_INCREMENT NOT NULL, created_by INT DEFAULT NULL, modified_by INT DEFAULT NULL, ancientPlace VARCHAR(255) DEFAULT NULL, uri1 VARCHAR(255) DEFAULT NULL, uri2 VARCHAR(255) DEFAULT NULL, uri3 VARCHAR(255) DEFAULT NULL, placeComment LONGTEXT DEFAULT NULL, deleted TINYINT(1) DEFAULT NULL, sort_value DOUBLE PRECISION DEFAULT NULL, creation_date DATETIME NOT NULL, modified_date DATETIME DEFAULT NULL, comment LONGTEXT DEFAULT NULL, INDEX IDX_7DE3B964DE12AB56 (created_by), INDEX IDX_7DE3B96425F94802 (modified_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE ancient_place ADD CONSTRAINT FK_7DE3B964DE12AB56 FOREIGN KEY (created_by) REFERENCES user (id)');
$this->addSql('ALTER TABLE ancient_place ADD CONSTRAINT FK_7DE3B96425F94802 FOREIGN KEY (modified_by) REFERENCES user (id)');
$this->addSql('ALTER TABLE hoard ADD ancient_place_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE hoard ADD CONSTRAINT FK_12E633E6259B0082 FOREIGN KEY (ancient_place_id) REFERENCES ancient_place (id)');
$this->addSql('CREATE INDEX IDX_12E633E6259B0082 ON hoard (ancient_place_id)');
$this->addSql('ALTER TABLE hoard_audit ADD ancient_place_id INT 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('DROP TABLE ancient_place');
$this->addSql('ALTER TABLE hoard DROP ancient_place_id');
$this->addSql('ALTER TABLE hoard_audit DROP ancient_place_id');
}
}