<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20220629163143 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE search_engine (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, value VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE sort_engine (id INT AUTO_INCREMENT NOT NULL, category_id INT DEFAULT NULL, sub_category_id INT DEFAULT NULL, button_id INT DEFAULT NULL, visiting_card_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, value VARCHAR(255) DEFAULT NULL, INDEX IDX_56138CAA12469DE2 (category_id), INDEX IDX_56138CAAF7BFE87C (sub_category_id), INDEX IDX_56138CAAA123E519 (button_id), INDEX IDX_56138CAAEB37EBA0 (visiting_card_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE sort_engine ADD CONSTRAINT FK_56138CAA12469DE2 FOREIGN KEY (category_id) REFERENCES category (id)');
$this->addSql('ALTER TABLE sort_engine ADD CONSTRAINT FK_56138CAAF7BFE87C FOREIGN KEY (sub_category_id) REFERENCES sub_category (id)');
$this->addSql('ALTER TABLE sort_engine ADD CONSTRAINT FK_56138CAAA123E519 FOREIGN KEY (button_id) REFERENCES button (id)');
$this->addSql('ALTER TABLE sort_engine ADD CONSTRAINT FK_56138CAAEB37EBA0 FOREIGN KEY (visiting_card_id) REFERENCES visiting_card (id)');
$this->addSql('ALTER TABLE button ADD search_engine_id INT DEFAULT NULL, ADD sort_engine_id INT DEFAULT NULL, ADD is_active TINYINT(1) DEFAULT NULL, ADD position INT DEFAULT NULL');
$this->addSql('ALTER TABLE button ADD CONSTRAINT FK_3A06AC3D5C978CA2 FOREIGN KEY (search_engine_id) REFERENCES search_engine (id)');
$this->addSql('ALTER TABLE button ADD CONSTRAINT FK_3A06AC3DA1268B49 FOREIGN KEY (sort_engine_id) REFERENCES sort_engine (id)');
$this->addSql('CREATE INDEX IDX_3A06AC3D5C978CA2 ON button (search_engine_id)');
$this->addSql('CREATE INDEX IDX_3A06AC3DA1268B49 ON button (sort_engine_id)');
$this->addSql('ALTER TABLE category ADD search_engine_id INT DEFAULT NULL, ADD sort_engine_id INT DEFAULT NULL, ADD is_active TINYINT(1) DEFAULT NULL, ADD position INT DEFAULT NULL');
$this->addSql('ALTER TABLE category ADD CONSTRAINT FK_64C19C15C978CA2 FOREIGN KEY (search_engine_id) REFERENCES search_engine (id)');
$this->addSql('ALTER TABLE category ADD CONSTRAINT FK_64C19C1A1268B49 FOREIGN KEY (sort_engine_id) REFERENCES sort_engine (id)');
$this->addSql('CREATE INDEX IDX_64C19C15C978CA2 ON category (search_engine_id)');
$this->addSql('CREATE INDEX IDX_64C19C1A1268B49 ON category (sort_engine_id)');
$this->addSql('ALTER TABLE menu ADD icon VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE sub_category ADD search_engine_id INT DEFAULT NULL, ADD sort_engine_id INT DEFAULT NULL, ADD is_active TINYINT(1) DEFAULT NULL, ADD position INT DEFAULT NULL');
$this->addSql('ALTER TABLE sub_category ADD CONSTRAINT FK_BCE3F7985C978CA2 FOREIGN KEY (search_engine_id) REFERENCES search_engine (id)');
$this->addSql('ALTER TABLE sub_category ADD CONSTRAINT FK_BCE3F798A1268B49 FOREIGN KEY (sort_engine_id) REFERENCES sort_engine (id)');
$this->addSql('CREATE INDEX IDX_BCE3F7985C978CA2 ON sub_category (search_engine_id)');
$this->addSql('CREATE INDEX IDX_BCE3F798A1268B49 ON sub_category (sort_engine_id)');
$this->addSql('ALTER TABLE visiting_card ADD search_engine_id INT DEFAULT NULL, ADD sort_engine_id INT DEFAULT NULL, ADD is_active TINYINT(1) DEFAULT NULL');
$this->addSql('ALTER TABLE visiting_card ADD CONSTRAINT FK_CB2C96CC5C978CA2 FOREIGN KEY (search_engine_id) REFERENCES search_engine (id)');
$this->addSql('ALTER TABLE visiting_card ADD CONSTRAINT FK_CB2C96CCA1268B49 FOREIGN KEY (sort_engine_id) REFERENCES sort_engine (id)');
$this->addSql('CREATE INDEX IDX_CB2C96CC5C978CA2 ON visiting_card (search_engine_id)');
$this->addSql('CREATE INDEX IDX_CB2C96CCA1268B49 ON visiting_card (sort_engine_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE button DROP FOREIGN KEY FK_3A06AC3D5C978CA2');
$this->addSql('ALTER TABLE category DROP FOREIGN KEY FK_64C19C15C978CA2');
$this->addSql('ALTER TABLE sub_category DROP FOREIGN KEY FK_BCE3F7985C978CA2');
$this->addSql('ALTER TABLE visiting_card DROP FOREIGN KEY FK_CB2C96CC5C978CA2');
$this->addSql('ALTER TABLE button DROP FOREIGN KEY FK_3A06AC3DA1268B49');
$this->addSql('ALTER TABLE category DROP FOREIGN KEY FK_64C19C1A1268B49');
$this->addSql('ALTER TABLE sub_category DROP FOREIGN KEY FK_BCE3F798A1268B49');
$this->addSql('ALTER TABLE visiting_card DROP FOREIGN KEY FK_CB2C96CCA1268B49');
$this->addSql('DROP TABLE search_engine');
$this->addSql('DROP TABLE sort_engine');
$this->addSql('DROP INDEX IDX_3A06AC3D5C978CA2 ON button');
$this->addSql('DROP INDEX IDX_3A06AC3DA1268B49 ON button');
$this->addSql('ALTER TABLE button DROP search_engine_id, DROP sort_engine_id, DROP is_active, DROP position');
$this->addSql('DROP INDEX IDX_64C19C15C978CA2 ON category');
$this->addSql('DROP INDEX IDX_64C19C1A1268B49 ON category');
$this->addSql('ALTER TABLE category DROP search_engine_id, DROP sort_engine_id, DROP is_active, DROP position');
$this->addSql('ALTER TABLE menu DROP icon');
$this->addSql('DROP INDEX IDX_BCE3F7985C978CA2 ON sub_category');
$this->addSql('DROP INDEX IDX_BCE3F798A1268B49 ON sub_category');
$this->addSql('ALTER TABLE sub_category DROP search_engine_id, DROP sort_engine_id, DROP is_active, DROP position');
$this->addSql('DROP INDEX IDX_CB2C96CC5C978CA2 ON visiting_card');
$this->addSql('DROP INDEX IDX_CB2C96CCA1268B49 ON visiting_card');
$this->addSql('ALTER TABLE visiting_card DROP search_engine_id, DROP sort_engine_id, DROP is_active');
}
}