<?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 Version20150720124115 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 object_image (id INT AUTO_INCREMENT NOT NULL, object_id INT DEFAULT NULL, image_id INT DEFAULT NULL, created_by INT DEFAULT NULL, modified_by INT DEFAULT NULL, creation_date DATETIME NOT NULL, modified_date DATETIME DEFAULT NULL, deleted TINYINT(1) DEFAULT NULL, INDEX IDX_411E50BD3DA5256D (image_id), INDEX IDX_411E50BDDE12AB56 (created_by), INDEX IDX_411E50BD25F94802 (modified_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE object_image ADD CONSTRAINT FK_411E50BD232D562B FOREIGN KEY (object_id) REFERENCES object (id)');
$this->addSql('ALTER TABLE object_image ADD CONSTRAINT FK_411E50BD3DA5256D FOREIGN KEY (image_id) REFERENCES image (id)');
$this->addSql('ALTER TABLE object_image ADD CONSTRAINT FK_411E50BDDE12AB56 FOREIGN KEY (created_by) REFERENCES user (id)');
$this->addSql('ALTER TABLE object_image ADD CONSTRAINT FK_411E50BD25F94802 FOREIGN KEY (modified_by) REFERENCES user (id)');
$this->addSql('ALTER TABLE coin_image CHANGE deleted deleted TINYINT(1) 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 object_image');
$this->addSql('ALTER TABLE coin_image CHANGE deleted deleted SMALLINT DEFAULT NULL');
$this->addSql('ALTER TABLE hoard ADD CONSTRAINT archaeology_end_period FOREIGN KEY (archaeology_end_period_id) REFERENCES period (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('ALTER TABLE hoard ADD CONSTRAINT archaeology_period FOREIGN KEY (archaeology_period_id) REFERENCES period (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
}
}