<?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 Version20200211092710 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('CREATE TABLE infos_discover_link (id INT AUTO_INCREMENT NOT NULL, residence_id INT NOT NULL, anchor VARCHAR(255) NOT NULL, link VARCHAR(255) NOT NULL, INDEX IDX_696EBB9F8B225FBD (residence_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE infos_discover (id INT AUTO_INCREMENT NOT NULL, residence_id INT NOT NULL, title VARCHAR(255) NOT NULL, text LONGTEXT NOT NULL, INDEX IDX_3FE06DAA8B225FBD (residence_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE infos_discover_link ADD CONSTRAINT FK_696EBB9F8B225FBD FOREIGN KEY (residence_id) REFERENCES residence (id)');
$this->addSql('ALTER TABLE infos_discover ADD CONSTRAINT FK_3FE06DAA8B225FBD FOREIGN KEY (residence_id) REFERENCES residence (id)');
$this->addSql('ALTER TABLE infos_event ADD residence_id INT NOT NULL');
$this->addSql('ALTER TABLE infos_event ADD CONSTRAINT FK_7456EA858B225FBD FOREIGN KEY (residence_id) REFERENCES residence (id)');
$this->addSql('CREATE INDEX IDX_7456EA858B225FBD ON infos_event (residence_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('DROP TABLE infos_discover_link');
$this->addSql('DROP TABLE infos_discover');
$this->addSql('ALTER TABLE infos_event DROP FOREIGN KEY FK_7456EA858B225FBD');
$this->addSql('DROP INDEX IDX_7456EA858B225FBD ON infos_event');
$this->addSql('ALTER TABLE infos_event DROP residence_id');
}
}