<?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 Version20240428100235 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 `order` (id INT AUTO_INCREMENT NOT NULL, customer_id INT NOT NULL, date DATETIME NOT NULL, amount DOUBLE PRECISION NOT NULL, tax INT NOT NULL, currency VARCHAR(20) NOT NULL, status VARCHAR(20) NOT NULL, gateway VARCHAR(255) NOT NULL, identifier VARCHAR(100) NOT NULL, INDEX IDX_F52993989395C3F3 (customer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE product (id INT AUTO_INCREMENT NOT NULL, customer_id INT DEFAULT NULL, slug VARCHAR(255) NOT NULL, image VARCHAR(255) DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, icon VARCHAR(255) DEFAULT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, deleted_by VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_D34A04AD9395C3F3 (customer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE product_category (product_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_CDFC73564584665A (product_id), INDEX IDX_CDFC735612469DE2 (category_id), PRIMARY KEY(product_id, category_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE product_order (product_id INT NOT NULL, order_id INT NOT NULL, INDEX IDX_5475E8C44584665A (product_id), INDEX IDX_5475E8C48D9F6D38 (order_id), PRIMARY KEY(product_id, order_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE product_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, locale VARCHAR(5) NOT NULL, INDEX IDX_1846DB702C2AC5D3 (translatable_id), UNIQUE INDEX product_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE `order` ADD CONSTRAINT FK_F52993989395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
$this->addSql('ALTER TABLE product ADD CONSTRAINT FK_D34A04AD9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
$this->addSql('ALTER TABLE product_category ADD CONSTRAINT FK_CDFC73564584665A FOREIGN KEY (product_id) REFERENCES product (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE product_category ADD CONSTRAINT FK_CDFC735612469DE2 FOREIGN KEY (category_id) REFERENCES category (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE product_order ADD CONSTRAINT FK_5475E8C44584665A FOREIGN KEY (product_id) REFERENCES product (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE product_order ADD CONSTRAINT FK_5475E8C48D9F6D38 FOREIGN KEY (order_id) REFERENCES `order` (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE product_translation ADD CONSTRAINT FK_1846DB702C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES product (id) ON DELETE CASCADE');
// $this->addSql('ALTER TABLE app_translations RENAME INDEX idx_ed8c63d37987212d TO IDX_439C0067987212D');
// $this->addSql('ALTER TABLE app_translations RENAME INDEX idx_ed8c63d312469de2 TO IDX_439C00612469DE2');
// $this->addSql('ALTER TABLE app_translations_translation RENAME INDEX idx_3f806f872c2ac5d3 TO IDX_6D4A86FF2C2AC5D3');
// $this->addSql('ALTER TABLE app_translations_translation RENAME INDEX app_translation_translation_unique_translation TO app_translations_translation_unique_translation');
// $this->addSql('DROP INDEX titles_only ON country_translation');
// $this->addSql('ALTER TABLE customer RENAME INDEX fk_81398e09f92f3e70 TO IDX_81398E09F92F3E70');
// $this->addSql('DROP INDEX name ON disease_translation');
// $this->addSql('DROP INDEX titles_only ON disease_translation');
// $this->addSql('DROP INDEX name ON drug_translation');
// $this->addSql('DROP INDEX titles_only ON drug_translation');
$this->addSql('ALTER TABLE landmark ADD layer VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE level ADD import_settings LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', ADD svg_optimized_file_variants LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\'');
// $this->addSql('DROP INDEX titles_only ON map_marker_translation');
// $this->addSql('DROP INDEX name ON map_marker_translation');
// $this->addSql('DROP INDEX name ON medical_procedure_translation');
// $this->addSql('DROP INDEX titles_only ON medical_procedure_translation');
// $this->addSql('DROP INDEX name ON page_translation');
// $this->addSql('DROP INDEX titles_only ON page_translation');
$this->addSql('ALTER TABLE route CHANGE access_level access_level LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\'');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE product_order DROP FOREIGN KEY FK_5475E8C48D9F6D38');
$this->addSql('ALTER TABLE product_category DROP FOREIGN KEY FK_CDFC73564584665A');
$this->addSql('ALTER TABLE product_order DROP FOREIGN KEY FK_5475E8C44584665A');
$this->addSql('ALTER TABLE product_translation DROP FOREIGN KEY FK_1846DB702C2AC5D3');
$this->addSql('DROP TABLE `order`');
$this->addSql('DROP TABLE product');
$this->addSql('DROP TABLE product_category');
$this->addSql('DROP TABLE product_order');
$this->addSql('DROP TABLE product_translation');
$this->addSql('ALTER TABLE app_translations RENAME INDEX idx_439c00612469de2 TO IDX_ED8C63D312469DE2');
$this->addSql('ALTER TABLE app_translations RENAME INDEX idx_439c0067987212d TO IDX_ED8C63D37987212D');
$this->addSql('ALTER TABLE app_translations_translation RENAME INDEX app_translations_translation_unique_translation TO app_translation_translation_unique_translation');
$this->addSql('ALTER TABLE app_translations_translation RENAME INDEX idx_6d4a86ff2c2ac5d3 TO IDX_3F806F872C2AC5D3');
$this->addSql('CREATE FULLTEXT INDEX titles_only ON country_translation (name)');
$this->addSql('ALTER TABLE customer RENAME INDEX idx_81398e09f92f3e70 TO FK_81398E09F92F3E70');
$this->addSql('CREATE FULLTEXT INDEX name ON disease_translation (name, description)');
$this->addSql('CREATE FULLTEXT INDEX titles_only ON disease_translation (name)');
$this->addSql('CREATE FULLTEXT INDEX name ON drug_translation (name, description)');
$this->addSql('CREATE FULLTEXT INDEX titles_only ON drug_translation (name)');
$this->addSql('ALTER TABLE landmark DROP layer');
$this->addSql('ALTER TABLE level DROP import_settings, DROP svg_optimized_file_variants');
$this->addSql('CREATE FULLTEXT INDEX titles_only ON map_marker_translation (name)');
$this->addSql('CREATE FULLTEXT INDEX name ON map_marker_translation (name, description)');
$this->addSql('CREATE FULLTEXT INDEX name ON medical_procedure_translation (name, description)');
$this->addSql('CREATE FULLTEXT INDEX titles_only ON medical_procedure_translation (name)');
$this->addSql('CREATE FULLTEXT INDEX name ON page_translation (name, excerpt, body)');
$this->addSql('CREATE FULLTEXT INDEX titles_only ON page_translation (name)');
$this->addSql('ALTER TABLE route CHANGE access_level access_level VARCHAR(20) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
}
}