<?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 Version20220330131646 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 obstacle (id INT AUTO_INCREMENT NOT NULL, obstacle_collection_id INT DEFAULT NULL, INDEX IDX_CCBF5DB1A8DC73DE (obstacle_collection_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE obstacle_collection (id INT AUTO_INCREMENT NOT NULL, picture_id INT DEFAULT NULL, INDEX IDX_F73D64C5EE45BDBF (picture_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE obstacle_collection_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, locale VARCHAR(5) NOT NULL, INDEX IDX_AD441AF02C2AC5D3 (translatable_id), UNIQUE INDEX obstacle_collection_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE obstacle_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT NOT NULL, locale VARCHAR(5) NOT NULL, INDEX IDX_97BB52D12C2AC5D3 (translatable_id), UNIQUE INDEX obstacle_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE page_review (page_id INT NOT NULL, review_id INT NOT NULL, INDEX IDX_169577D8C4663E4 (page_id), INDEX IDX_169577D83E2E969B (review_id), PRIMARY KEY(page_id, review_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE quote (id INT AUTO_INCREMENT NOT NULL, picture_id INT DEFAULT NULL, picturebis_id INT DEFAULT NULL, page_id INT NOT NULL, disposition VARCHAR(20) NOT NULL, INDEX IDX_6B71CBF4EE45BDBF (picture_id), INDEX IDX_6B71CBF48AB4624C (picturebis_id), INDEX IDX_6B71CBF4C4663E4 (page_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE quote_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, content LONGTEXT NOT NULL, locale VARCHAR(5) NOT NULL, INDEX IDX_E86A78112C2AC5D3 (translatable_id), UNIQUE INDEX quote_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE review (id INT AUTO_INCREMENT NOT NULL, picture_id INT DEFAULT NULL, INDEX IDX_794381C6EE45BDBF (picture_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE review_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT NOT NULL, locale VARCHAR(5) NOT NULL, INDEX IDX_CAAFA9132C2AC5D3 (translatable_id), UNIQUE INDEX review_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE setting (id INT AUTO_INCREMENT NOT NULL, keyname VARCHAR(255) NOT NULL, value VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE testimonial (id INT AUTO_INCREMENT NOT NULL, picture_id INT NOT NULL, page_id INT NOT NULL, working_people INT DEFAULT NULL, program_starting_date INT DEFAULT NULL, latitude DOUBLE PRECISION NOT NULL, longitude DOUBLE PRECISION NOT NULL, youtube_url VARCHAR(255) DEFAULT NULL, layout VARCHAR(20) NOT NULL, INDEX IDX_E6BDCDF7EE45BDBF (picture_id), INDEX IDX_E6BDCDF7C4663E4 (page_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE testimonial_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT NOT NULL, map_content LONGTEXT NOT NULL, labels LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', locale VARCHAR(5) NOT NULL, INDEX IDX_82D869952C2AC5D3 (translatable_id), UNIQUE INDEX testimonial_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE obstacle ADD CONSTRAINT FK_CCBF5DB1A8DC73DE FOREIGN KEY (obstacle_collection_id) REFERENCES obstacle_collection (id)');
$this->addSql('ALTER TABLE obstacle_collection ADD CONSTRAINT FK_F73D64C5EE45BDBF FOREIGN KEY (picture_id) REFERENCES media__media (id)');
$this->addSql('ALTER TABLE obstacle_collection_translation ADD CONSTRAINT FK_AD441AF02C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES obstacle_collection (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE obstacle_translation ADD CONSTRAINT FK_97BB52D12C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES obstacle (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE page_review ADD CONSTRAINT FK_169577D8C4663E4 FOREIGN KEY (page_id) REFERENCES page (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE page_review ADD CONSTRAINT FK_169577D83E2E969B FOREIGN KEY (review_id) REFERENCES review (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE quote ADD CONSTRAINT FK_6B71CBF4EE45BDBF FOREIGN KEY (picture_id) REFERENCES media__media (id)');
$this->addSql('ALTER TABLE quote ADD CONSTRAINT FK_6B71CBF48AB4624C FOREIGN KEY (picturebis_id) REFERENCES media__media (id)');
$this->addSql('ALTER TABLE quote ADD CONSTRAINT FK_6B71CBF4C4663E4 FOREIGN KEY (page_id) REFERENCES page (id)');
$this->addSql('ALTER TABLE quote_translation ADD CONSTRAINT FK_E86A78112C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES quote (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE review ADD CONSTRAINT FK_794381C6EE45BDBF FOREIGN KEY (picture_id) REFERENCES media__media (id)');
$this->addSql('ALTER TABLE review_translation ADD CONSTRAINT FK_CAAFA9132C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES review (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE testimonial ADD CONSTRAINT FK_E6BDCDF7EE45BDBF FOREIGN KEY (picture_id) REFERENCES media__media (id)');
$this->addSql('ALTER TABLE testimonial ADD CONSTRAINT FK_E6BDCDF7C4663E4 FOREIGN KEY (page_id) REFERENCES page (id)');
$this->addSql('ALTER TABLE testimonial_translation ADD CONSTRAINT FK_82D869952C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES testimonial (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE media__media CHANGE provider_metadata provider_metadata JSON DEFAULT NULL');
$this->addSql('ALTER TABLE page ADD obstacle_id INT DEFAULT NULL, ADD gallery_id INT DEFAULT NULL, ADD is_virtual_visit TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620F616DCDF FOREIGN KEY (obstacle_id) REFERENCES obstacle_collection (id)');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB6204E7AF8F FOREIGN KEY (gallery_id) REFERENCES media__gallery (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_140AB620F616DCDF ON page (obstacle_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_140AB6204E7AF8F ON page (gallery_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE obstacle_translation DROP FOREIGN KEY FK_97BB52D12C2AC5D3');
$this->addSql('ALTER TABLE obstacle DROP FOREIGN KEY FK_CCBF5DB1A8DC73DE');
$this->addSql('ALTER TABLE obstacle_collection_translation DROP FOREIGN KEY FK_AD441AF02C2AC5D3');
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB620F616DCDF');
$this->addSql('ALTER TABLE quote_translation DROP FOREIGN KEY FK_E86A78112C2AC5D3');
$this->addSql('ALTER TABLE page_review DROP FOREIGN KEY FK_169577D83E2E969B');
$this->addSql('ALTER TABLE review_translation DROP FOREIGN KEY FK_CAAFA9132C2AC5D3');
$this->addSql('ALTER TABLE testimonial_translation DROP FOREIGN KEY FK_82D869952C2AC5D3');
$this->addSql('DROP TABLE obstacle');
$this->addSql('DROP TABLE obstacle_collection');
$this->addSql('DROP TABLE obstacle_collection_translation');
$this->addSql('DROP TABLE obstacle_translation');
$this->addSql('DROP TABLE page_review');
$this->addSql('DROP TABLE quote');
$this->addSql('DROP TABLE quote_translation');
$this->addSql('DROP TABLE review');
$this->addSql('DROP TABLE review_translation');
$this->addSql('DROP TABLE setting');
$this->addSql('DROP TABLE testimonial');
$this->addSql('DROP TABLE testimonial_translation');
$this->addSql('ALTER TABLE media__media CHANGE provider_metadata provider_metadata JSON DEFAULT NULL');
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB6204E7AF8F');
$this->addSql('DROP INDEX UNIQ_140AB620F616DCDF ON page');
$this->addSql('DROP INDEX UNIQ_140AB6204E7AF8F ON page');
$this->addSql('ALTER TABLE page DROP obstacle_id, DROP gallery_id, DROP is_virtual_visit');
}
}