<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220206225113 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->addSql('CREATE TABLE icon (id INT AUTO_INCREMENT NOT NULL, label VARCHAR(50) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE territory_feature (id INT AUTO_INCREMENT NOT NULL, icon_id INT DEFAULT NULL, territory_feature_list_id INT NOT NULL, label VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_F59737DF54B9D732 (icon_id), INDEX IDX_F59737DF7BA8F14C (territory_feature_list_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE territory_feature_list (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE territory_feature ADD CONSTRAINT FK_F59737DF54B9D732 FOREIGN KEY (icon_id) REFERENCES icon (id)');
$this->addSql('ALTER TABLE territory_feature ADD CONSTRAINT FK_F59737DF7BA8F14C FOREIGN KEY (territory_feature_list_id) REFERENCES territory_feature_list (id)');
$this->addSql('ALTER TABLE territory ADD around_feature_list_id INT DEFAULT NULL, ADD to_know_feature_list_id INT DEFAULT NULL, ADD companies_feature_list_id INT DEFAULT NULL, ADD entrepreneurship_feature_list_id INT DEFAULT NULL, ADD climate_feature_list_id INT DEFAULT NULL, ADD real_estate_feature_list_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE territory ADD CONSTRAINT FK_E974396647D4380F FOREIGN KEY (around_feature_list_id) REFERENCES territory_feature_list (id)');
$this->addSql('ALTER TABLE territory ADD CONSTRAINT FK_E9743966333677B0 FOREIGN KEY (to_know_feature_list_id) REFERENCES territory_feature_list (id)');
$this->addSql('ALTER TABLE territory ADD CONSTRAINT FK_E97439664DA7CE24 FOREIGN KEY (companies_feature_list_id) REFERENCES territory_feature_list (id)');
$this->addSql('ALTER TABLE territory ADD CONSTRAINT FK_E97439664578153 FOREIGN KEY (entrepreneurship_feature_list_id) REFERENCES territory_feature_list (id)');
$this->addSql('ALTER TABLE territory ADD CONSTRAINT FK_E97439668031DB37 FOREIGN KEY (climate_feature_list_id) REFERENCES territory_feature_list (id)');
$this->addSql('ALTER TABLE territory ADD CONSTRAINT FK_E9743966173BFE1 FOREIGN KEY (real_estate_feature_list_id) REFERENCES territory_feature_list (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E974396647D4380F ON territory (around_feature_list_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E9743966333677B0 ON territory (to_know_feature_list_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E97439664DA7CE24 ON territory (companies_feature_list_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E97439664578153 ON territory (entrepreneurship_feature_list_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E97439668031DB37 ON territory (climate_feature_list_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E9743966173BFE1 ON territory (real_estate_feature_list_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE territory_feature DROP FOREIGN KEY FK_F59737DF54B9D732');
$this->addSql('ALTER TABLE territory DROP FOREIGN KEY FK_E974396647D4380F');
$this->addSql('ALTER TABLE territory DROP FOREIGN KEY FK_E9743966333677B0');
$this->addSql('ALTER TABLE territory DROP FOREIGN KEY FK_E97439664DA7CE24');
$this->addSql('ALTER TABLE territory DROP FOREIGN KEY FK_E97439664578153');
$this->addSql('ALTER TABLE territory DROP FOREIGN KEY FK_E97439668031DB37');
$this->addSql('ALTER TABLE territory DROP FOREIGN KEY FK_E9743966173BFE1');
$this->addSql('ALTER TABLE territory_feature DROP FOREIGN KEY FK_F59737DF7BA8F14C');
$this->addSql('DROP TABLE icon');
$this->addSql('DROP TABLE territory_feature');
$this->addSql('DROP TABLE territory_feature_list');
$this->addSql('DROP INDEX UNIQ_E974396647D4380F ON territory');
$this->addSql('DROP INDEX UNIQ_E9743966333677B0 ON territory');
$this->addSql('DROP INDEX UNIQ_E97439664DA7CE24 ON territory');
$this->addSql('DROP INDEX UNIQ_E97439664578153 ON territory');
$this->addSql('DROP INDEX UNIQ_E97439668031DB37 ON territory');
$this->addSql('DROP INDEX UNIQ_E9743966173BFE1 ON territory');
$this->addSql('ALTER TABLE territory DROP around_feature_list_id, DROP to_know_feature_list_id, DROP companies_feature_list_id, DROP entrepreneurship_feature_list_id, DROP climate_feature_list_id, DROP real_estate_feature_list_id');
}
}