migrations/Version20231209094352.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20231209094352 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('CREATE TABLE cohort (id INT AUTO_INCREMENT NOT NULL, customer_id INT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, INDEX IDX_D3B8C16B9395C3F3 (customer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE cohort_patient (cohort_id INT NOT NULL, patient_id INT NOT NULL, INDEX IDX_B1B58AD535983C93 (cohort_id), INDEX IDX_B1B58AD56B899279 (patient_id), PRIMARY KEY(cohort_id, patient_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE cohort_form (id INT AUTO_INCREMENT NOT NULL, customer_id INT NOT NULL, name VARCHAR(255) NOT NULL, static_fields LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', show_therapy_field TINYINT(1) DEFAULT NULL, INDEX IDX_4EE67B1F9395C3F3 (customer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('CREATE TABLE cohort_form_test (cohort_form_id INT NOT NULL, test_id INT NOT NULL, INDEX IDX_1841E740F499C643 (cohort_form_id), INDEX IDX_1841E7401E5D0459 (test_id), PRIMARY KEY(cohort_form_id, test_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('CREATE TABLE cohort_task (id INT AUTO_INCREMENT NOT NULL, cohort_id INT NOT NULL, cohort_form_id INT NOT NULL, time_range INT NOT NULL, date DATE NOT NULL, auto_prolong TINYINT(1) DEFAULT NULL, INDEX IDX_4E105D7535983C93 (cohort_id), UNIQUE INDEX UNIQ_4E105D75F499C643 (cohort_form_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  23.         $this->addSql('ALTER TABLE cohort ADD CONSTRAINT FK_D3B8C16B9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
  24.         $this->addSql('ALTER TABLE cohort_patient ADD CONSTRAINT FK_B1B58AD535983C93 FOREIGN KEY (cohort_id) REFERENCES cohort (id) ON DELETE CASCADE');
  25.         $this->addSql('ALTER TABLE cohort_patient ADD CONSTRAINT FK_B1B58AD56B899279 FOREIGN KEY (patient_id) REFERENCES patient (id) ON DELETE CASCADE');
  26.         $this->addSql('ALTER TABLE cohort_form ADD CONSTRAINT FK_4EE67B1F9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
  27.         $this->addSql('ALTER TABLE cohort_form_test ADD CONSTRAINT FK_1841E740F499C643 FOREIGN KEY (cohort_form_id) REFERENCES cohort_form (id) ON DELETE CASCADE');
  28.         $this->addSql('ALTER TABLE cohort_form_test ADD CONSTRAINT FK_1841E7401E5D0459 FOREIGN KEY (test_id) REFERENCES test (id) ON DELETE CASCADE');
  29.         $this->addSql('ALTER TABLE cohort_task ADD CONSTRAINT FK_4E105D7535983C93 FOREIGN KEY (cohort_id) REFERENCES cohort (id)');
  30.         $this->addSql('ALTER TABLE cohort_task ADD CONSTRAINT FK_4E105D75F499C643 FOREIGN KEY (cohort_form_id) REFERENCES cohort_form (id)');
  31. //        $this->addSql('DROP TABLE al_wp_posts_old');
  32. //        $this->addSql('DROP INDEX post_content ON al_wp_posts');
  33. //        $this->addSql('DROP INDEX type_status_date ON al_wp_posts');
  34. //        $this->addSql('DROP INDEX post_parent ON al_wp_posts');
  35. //        $this->addSql('DROP INDEX post_title ON al_wp_posts');
  36. //        $this->addSql('ALTER TABLE al_wp_posts CHANGE ID id INT AUTO_INCREMENT NOT NULL, CHANGE post_date post_date DATETIME NOT NULL, CHANGE post_status post_status LONGTEXT NOT NULL, CHANGE post_parent post_parent INT NOT NULL, CHANGE menu_order menu_order INT NOT NULL, CHANGE post_type post_type LONGTEXT NOT NULL');
  37. //        $this->addSql('ALTER TABLE app_translations RENAME INDEX idx_ed8c63d37987212d TO IDX_439C0067987212D');
  38. //        $this->addSql('ALTER TABLE app_translations RENAME INDEX idx_ed8c63d312469de2 TO IDX_439C00612469DE2');
  39. //        $this->addSql('ALTER TABLE app_translations_translation RENAME INDEX idx_3f806f872c2ac5d3 TO IDX_6D4A86FF2C2AC5D3');
  40. //        $this->addSql('ALTER TABLE app_translations_translation RENAME INDEX app_translation_translation_unique_translation TO app_translations_translation_unique_translation');
  41. //        $this->addSql('DROP INDEX titles_only ON country_translation');
  42. //        $this->addSql('ALTER TABLE custom_entity CHANGE external_id1_taxonomy external_id1_taxonomy INT DEFAULT NULL, CHANGE external_id2_taxonomy external_id2_taxonomy INT DEFAULT NULL');
  43. //        $this->addSql('ALTER TABLE customer RENAME INDEX fk_81398e09f92f3e70 TO IDX_81398E09F92F3E70');
  44. //        $this->addSql('ALTER TABLE disease CHANGE type type VARCHAR(30) NOT NULL');
  45. //        $this->addSql('DROP INDEX name ON disease_translation');
  46. //        $this->addSql('DROP INDEX titles_only ON disease_translation');
  47. //        $this->addSql('ALTER TABLE drug CHANGE type type VARCHAR(30) NOT NULL');
  48. //        $this->addSql('DROP INDEX name ON drug_translation');
  49. //        $this->addSql('DROP INDEX titles_only ON drug_translation');
  50. //        $this->addSql('ALTER TABLE import CHANGE type type VARCHAR(255) NOT NULL');
  51. //        $this->addSql('ALTER TABLE level CHANGE svg_optimized_file svg_optimized_file VARCHAR(255) NOT NULL');
  52. //        $this->addSql('DROP INDEX titles_only ON map_marker_translation');
  53. //        $this->addSql('DROP INDEX name ON map_marker_translation');
  54. //        $this->addSql('ALTER TABLE medical_procedure CHANGE type type VARCHAR(30) NOT NULL');
  55. //        $this->addSql('DROP INDEX name ON medical_procedure_translation');
  56. //        $this->addSql('DROP INDEX titles_only ON medical_procedure_translation');
  57. //        $this->addSql('DROP INDEX name ON page_translation');
  58. //        $this->addSql('DROP INDEX titles_only ON page_translation');
  59. //        $this->addSql('ALTER TABLE test_definition CHANGE type type VARCHAR(30) NOT NULL');
  60.     }
  61.     public function down(Schema $schema): void
  62.     {
  63.         // this down() migration is auto-generated, please modify it to your needs
  64.         $this->addSql('ALTER TABLE cohort_patient DROP FOREIGN KEY FK_B1B58AD535983C93');
  65.         $this->addSql('ALTER TABLE cohort_task DROP FOREIGN KEY FK_4E105D7535983C93');
  66.         $this->addSql('ALTER TABLE cohort_form_test DROP FOREIGN KEY FK_1841E740F499C643');
  67.         $this->addSql('ALTER TABLE cohort_task DROP FOREIGN KEY FK_4E105D75F499C643');
  68.         $this->addSql('CREATE TABLE al_wp_posts_old (id INT AUTO_INCREMENT NOT NULL, post_date DATETIME NOT NULL, post_content LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, post_title TEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, post_excerpt TEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, post_status LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, post_parent INT NOT NULL, menu_order INT NOT NULL, post_type LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  69.         $this->addSql('DROP TABLE cohort');
  70.         $this->addSql('DROP TABLE cohort_patient');
  71.         $this->addSql('DROP TABLE cohort_form');
  72.         $this->addSql('DROP TABLE cohort_form_test');
  73.         $this->addSql('DROP TABLE cohort_task');
  74.         $this->addSql('ALTER TABLE al_wp_posts CHANGE id ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, CHANGE post_date post_date DATETIME DEFAULT \'0000-00-00 00:00:00\' NOT NULL, CHANGE post_status post_status VARCHAR(20) CHARACTER SET utf8 DEFAULT \'publish\' NOT NULL COLLATE `utf8_general_ci`, CHANGE post_parent post_parent BIGINT UNSIGNED DEFAULT 0 NOT NULL, CHANGE menu_order menu_order INT DEFAULT 0 NOT NULL, CHANGE post_type post_type VARCHAR(20) CHARACTER SET utf8 DEFAULT \'post\' NOT NULL COLLATE `utf8_general_ci`');
  75.         $this->addSql('CREATE FULLTEXT INDEX post_content ON al_wp_posts (post_content)');
  76.         $this->addSql('CREATE INDEX type_status_date ON al_wp_posts (post_type, post_status, post_date, ID)');
  77.         $this->addSql('CREATE INDEX post_parent ON al_wp_posts (post_parent)');
  78.         $this->addSql('CREATE FULLTEXT INDEX post_title ON al_wp_posts (post_title)');
  79.         $this->addSql('ALTER TABLE app_translations RENAME INDEX idx_439c00612469de2 TO IDX_ED8C63D312469DE2');
  80.         $this->addSql('ALTER TABLE app_translations RENAME INDEX idx_439c0067987212d TO IDX_ED8C63D37987212D');
  81.         $this->addSql('ALTER TABLE app_translations_translation RENAME INDEX app_translations_translation_unique_translation TO app_translation_translation_unique_translation');
  82.         $this->addSql('ALTER TABLE app_translations_translation RENAME INDEX idx_6d4a86ff2c2ac5d3 TO IDX_3F806F872C2AC5D3');
  83.         $this->addSql('CREATE FULLTEXT INDEX titles_only ON country_translation (name)');
  84.         $this->addSql('ALTER TABLE custom_entity CHANGE external_id1_taxonomy external_id1_taxonomy TINYINT(1) DEFAULT NULL, CHANGE external_id2_taxonomy external_id2_taxonomy TINYINT(1) DEFAULT NULL');
  85.         $this->addSql('ALTER TABLE customer RENAME INDEX idx_81398e09f92f3e70 TO FK_81398E09F92F3E70');
  86.         $this->addSql('ALTER TABLE disease CHANGE type type VARCHAR(30) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
  87.         $this->addSql('CREATE FULLTEXT INDEX name ON disease_translation (name, description)');
  88.         $this->addSql('CREATE FULLTEXT INDEX titles_only ON disease_translation (name)');
  89.         $this->addSql('ALTER TABLE drug CHANGE type type VARCHAR(30) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
  90.         $this->addSql('CREATE FULLTEXT INDEX name ON drug_translation (name, description)');
  91.         $this->addSql('CREATE FULLTEXT INDEX titles_only ON drug_translation (name)');
  92.         $this->addSql('ALTER TABLE import CHANGE type type VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
  93.         $this->addSql('ALTER TABLE level CHANGE svg_optimized_file svg_optimized_file VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
  94.         $this->addSql('CREATE FULLTEXT INDEX titles_only ON map_marker_translation (name)');
  95.         $this->addSql('CREATE FULLTEXT INDEX name ON map_marker_translation (name, description)');
  96.         $this->addSql('ALTER TABLE medical_procedure CHANGE type type VARCHAR(30) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
  97.         $this->addSql('CREATE FULLTEXT INDEX name ON medical_procedure_translation (name, description)');
  98.         $this->addSql('CREATE FULLTEXT INDEX titles_only ON medical_procedure_translation (name)');
  99.         $this->addSql('CREATE FULLTEXT INDEX name ON page_translation (name, excerpt, body)');
  100.         $this->addSql('CREATE FULLTEXT INDEX titles_only ON page_translation (name)');
  101.         $this->addSql('ALTER TABLE test_definition CHANGE type type VARCHAR(30) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
  102.     }
  103. }