<?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 Version20240523063959 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 app_custom_function_customer (app_custom_function_id INT NOT NULL, customer_id INT NOT NULL, INDEX IDX_463D88903129F6B3 (app_custom_function_id), INDEX IDX_463D88909395C3F3 (customer_id), PRIMARY KEY(app_custom_function_id, customer_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE app_custom_function_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_179CA5482C2AC5D3 (translatable_id), UNIQUE INDEX app_custom_function_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE expression_function (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, public TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE expression_function_customer (expression_function_id INT NOT NULL, customer_id INT NOT NULL, INDEX IDX_5DEF97CCF53B00EE (expression_function_id), INDEX IDX_5DEF97CC9395C3F3 (customer_id), PRIMARY KEY(expression_function_id, customer_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE expression_function_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_D7BDCFE12C2AC5D3 (translatable_id), UNIQUE INDEX expression_function_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE patient_division (patient_id INT NOT NULL, division_id INT NOT NULL, INDEX IDX_27921FB16B899279 (patient_id), INDEX IDX_27921FB141859289 (division_id), PRIMARY KEY(patient_id, division_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE app_custom_function_customer ADD CONSTRAINT FK_463D88903129F6B3 FOREIGN KEY (app_custom_function_id) REFERENCES app_custom_function (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE app_custom_function_customer ADD CONSTRAINT FK_463D88909395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE app_custom_function_translation ADD CONSTRAINT FK_179CA5482C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES app_custom_function (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE expression_function_customer ADD CONSTRAINT FK_5DEF97CCF53B00EE FOREIGN KEY (expression_function_id) REFERENCES expression_function (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE expression_function_customer ADD CONSTRAINT FK_5DEF97CC9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE expression_function_translation ADD CONSTRAINT FK_D7BDCFE12C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES expression_function (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE patient_division ADD CONSTRAINT FK_27921FB16B899279 FOREIGN KEY (patient_id) REFERENCES patient (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE patient_division ADD CONSTRAINT FK_27921FB141859289 FOREIGN KEY (division_id) REFERENCES division (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE app_custom_function DROP FOREIGN KEY FK_75A6D4D09395C3F3');
$this->addSql('DROP INDEX IDX_75A6D4D09395C3F3 ON app_custom_function');
$this->addSql('ALTER TABLE app_custom_function ADD authorization TINYINT(1) NOT NULL, ADD admin_authorization TINYINT(1) NOT NULL, ADD exteded TINYINT(1) NOT NULL, DROP customer_id');
// $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 ADD allow_divisions TINYINT(1) DEFAULT NULL, ADD notes LONGTEXT DEFAULT NULL, ADD url VARCHAR(255) DEFAULT NULL, ADD contact_person VARCHAR(255) DEFAULT NULL, ADD customer_access_settings LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\'');
// $this->addSql('ALTER TABLE customer RENAME INDEX fk_81398e09f92f3e70 TO IDX_81398E09F92F3E70');
// $this->addSql('DROP INDEX titles_only ON disease_translation');
// $this->addSql('DROP INDEX name ON disease_translation');
$this->addSql('ALTER TABLE division ADD division_access_settings LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', ADD override_access_settings TINYINT(1) DEFAULT NULL');
// $this->addSql('DROP INDEX titles_only ON drug_translation');
// $this->addSql('DROP INDEX name ON drug_translation');
$this->addSql('ALTER TABLE flow ADD is_reserved TINYINT(1) DEFAULT NULL, ADD special_flow_slug VARCHAR(255) DEFAULT NULL');
// $this->addSql('DROP INDEX titles_only ON map_marker_translation');
// $this->addSql('DROP INDEX name ON map_marker_translation');
// $this->addSql('DROP INDEX titles_only ON medical_procedure_translation');
// $this->addSql('DROP INDEX name 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 patient DROP FOREIGN KEY FK_1ADAD7EB41859289');
$this->addSql('DROP INDEX IDX_1ADAD7EB41859289 ON patient');
$this->addSql('ALTER TABLE patient DROP division_id');
$this->addSql('ALTER TABLE patient_store_scheme_child ADD divisions LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\'');
$this->addSql('ALTER TABLE test_definition ADD special_test_definition_slug VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE user ADD division_id INT DEFAULT NULL, ADD view_code TINYINT(1) DEFAULT NULL, ADD view_division TINYINT(1) DEFAULT NULL, ADD view_all TINYINT(1) DEFAULT NULL, ADD edit_code TINYINT(1) DEFAULT NULL, ADD edit_division TINYINT(1) DEFAULT NULL, ADD edit_all TINYINT(1) DEFAULT NULL, ADD override_access_settings TINYINT(1) DEFAULT NULL, ADD user_access_settings LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\'');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D64941859289 FOREIGN KEY (division_id) REFERENCES division (id)');
$this->addSql('CREATE INDEX IDX_8D93D64941859289 ON user (division_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE expression_function_customer DROP FOREIGN KEY FK_5DEF97CCF53B00EE');
$this->addSql('ALTER TABLE expression_function_translation DROP FOREIGN KEY FK_D7BDCFE12C2AC5D3');
$this->addSql('DROP TABLE app_custom_function_customer');
$this->addSql('DROP TABLE app_custom_function_translation');
$this->addSql('DROP TABLE expression_function');
$this->addSql('DROP TABLE expression_function_customer');
$this->addSql('DROP TABLE expression_function_translation');
$this->addSql('DROP TABLE patient_division');
$this->addSql('ALTER TABLE app_custom_function ADD customer_id INT NOT NULL, DROP authorization, DROP admin_authorization, DROP exteded');
$this->addSql('ALTER TABLE app_custom_function ADD CONSTRAINT FK_75A6D4D09395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
$this->addSql('CREATE INDEX IDX_75A6D4D09395C3F3 ON app_custom_function (customer_id)');
$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 DROP allow_divisions, DROP notes, DROP url, DROP contact_person, DROP customer_access_settings');
$this->addSql('ALTER TABLE customer RENAME INDEX idx_81398e09f92f3e70 TO FK_81398E09F92F3E70');
$this->addSql('CREATE FULLTEXT INDEX titles_only ON disease_translation (name)');
$this->addSql('CREATE FULLTEXT INDEX name ON disease_translation (name, description)');
$this->addSql('ALTER TABLE division DROP division_access_settings, DROP override_access_settings');
$this->addSql('CREATE FULLTEXT INDEX titles_only ON drug_translation (name)');
$this->addSql('CREATE FULLTEXT INDEX name ON drug_translation (name, description)');
$this->addSql('ALTER TABLE flow DROP is_reserved, DROP special_flow_slug');
$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 titles_only ON medical_procedure_translation (name)');
$this->addSql('CREATE FULLTEXT INDEX name ON medical_procedure_translation (name, description)');
$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 patient ADD division_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE patient ADD CONSTRAINT FK_1ADAD7EB41859289 FOREIGN KEY (division_id) REFERENCES division (id)');
$this->addSql('CREATE INDEX IDX_1ADAD7EB41859289 ON patient (division_id)');
$this->addSql('ALTER TABLE patient_store_scheme_child DROP divisions');
$this->addSql('ALTER TABLE test_definition DROP special_test_definition_slug');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D64941859289');
$this->addSql('DROP INDEX IDX_8D93D64941859289 ON user');
$this->addSql('ALTER TABLE user DROP division_id, DROP view_code, DROP view_division, DROP view_all, DROP edit_code, DROP edit_division, DROP edit_all, DROP override_access_settings, DROP user_access_settings');
}
}