migrations/Version20230503081204.php line 1

Open in your IDE?
  1. <?php
  2. /* @noinspection PhpUnused */
  3. declare(strict_types=1);
  4. namespace DoctrineMigrations;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\Migrations\AbstractMigration;
  7. /**
  8.  * Auto-generated Migration: Please modify to your needs!
  9.  */
  10. final class Version20230503081204 extends AbstractMigration
  11. {
  12.     public function getDescription(): string
  13.     {
  14.         return '';
  15.     }
  16.     public function up(Schema $schema): void
  17.     {
  18.         // this up() migration is auto-generated, please modify it to your needs
  19.         $this->addSql(
  20.             '
  21.                 CREATE TABLE oim_case (
  22.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
  23.                     case_manager_1_id INT NOT NULL COMMENT \'Internal ID\',
  24.                     case_manager_2_id INT DEFAULT NULL COMMENT \'Internal ID\',
  25.                     data_protection_declaration_file_id INT DEFAULT NULL COMMENT \'Internal ID\',
  26.                     employee_id INT NOT NULL COMMENT \'Internal ID\',
  27.                     employee_business_country_id VARCHAR(2) DEFAULT NULL
  28.                         COMMENT \'Country code in upper case (ISO 3166-1 Alpha-2)\',
  29.                     release_of_confidentiality_case_manager_file_id INT DEFAULT NULL COMMENT \'Internal ID\',
  30.                     release_of_confidentiality_occupational_physician_file_id INT DEFAULT NULL COMMENT \'Internal ID\',
  31.                     status_id INT DEFAULT NULL COMMENT \'Internal ID\',
  32.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
  33.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
  34.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\',
  35.                     accepted SMALLINT NOT NULL COMMENT \'Flag if employee has accepted the case\',
  36.                     briefing_date DATETIME DEFAULT NULL COMMENT \'Briefing date\',
  37.                     briefing_notes TEXT DEFAULT NULL COMMENT \'Briefing notes\',
  38.                     completion_date DATETIME DEFAULT NULL COMMENT \'Date of completion for the OIM case\',
  39.                     contract_type VARCHAR(225) DEFAULT NULL COMMENT \'Contract type for employee\',
  40.                     data_protection_declaration_signed_date DATETIME DEFAULT NULL
  41.                         COMMENT \'Date protection declaration signed date\',
  42.                     degree_of_disability INT NOT NULL COMMENT \'Employee\'\'s degree of disability in percent\',
  43.                     employee_business_address VARCHAR(225) DEFAULT NULL COMMENT \'Business address for employee\',
  44.                     employee_business_city VARCHAR(225) DEFAULT NULL COMMENT \'Business city for employee\',
  45.                     employee_business_phone VARCHAR(225) DEFAULT NULL COMMENT \'Business phone number for employee\',
  46.                     employee_business_zip_code VARCHAR(16) DEFAULT NULL COMMENT \'Business zip code for employee\',
  47.                     employee_working_at_case_start SMALLINT NOT NULL
  48.                         COMMENT \'Employee is working at start of OIM case\',
  49.                     expected_duration VARCHAR(32) DEFAULT NULL COMMENT \'Expected duration\',
  50.                     letter_of_invitation_1_date DATETIME DEFAULT NULL COMMENT \'Date of first invitation letter\',
  51.                     letter_of_invitation_1_reply_date DATETIME DEFAULT NULL
  52.                         COMMENT \'Date of reply for first invitation letter\',
  53.                     letter_of_invitation_2_date DATETIME DEFAULT NULL COMMENT \'Date of second invitation letter\',
  54.                     letter_of_invitation_2_reply_date DATETIME DEFAULT NULL
  55.                         COMMENT \'Date of reply for second invitation letter\',
  56.                     letter_of_invitation_3_date DATETIME DEFAULT NULL COMMENT \'Date of third invitation letter\',
  57.                     letter_of_invitation_3_reply_date DATETIME DEFAULT NULL
  58.                         COMMENT \'Date of reply for third invitation letter\',
  59.                     occupational_physician_involved SMALLINT NOT NULL
  60.                         COMMENT \'Flag if an occupational physician is involved in the case\',
  61.                     release_of_confidentiality_case_manager_signed_date DATETIME DEFAULT NULL
  62.                         COMMENT \'Release of confidentiality case manager signed date\',
  63.                     release_of_confidentiality_occupational_physician_signed_date DATETIME DEFAULT NULL
  64.                         COMMENT \'Release of confidentiality occupational physician signed date\',
  65.                     representatives_for_disabled_employees_involved SMALLINT DEFAULT NULL
  66.                         COMMENT \'Flag for the involvement of representatives for disabled employees\',
  67.                     shift_schedule VARCHAR(225) DEFAULT NULL COMMENT \'Shift schedule for employee\',
  68.                     separation_date DATETIME DEFAULT NULL COMMENT \'Separation date of employee\',
  69.                     sick_leave_ratio VARCHAR(255) NOT NULL COMMENT \'Sick leave ratio for employee\',
  70.                     successful SMALLINT DEFAULT NULL COMMENT \'Flag if case ended successfully\',
  71.                     trusted_person_full_address VARCHAR(1000) DEFAULT NULL COMMENT \'Trusted person full address\',
  72.                     trusted_person_full_name VARCHAR(500) DEFAULT NULL COMMENT \'Trusted person full name\',
  73.                     workplace VARCHAR(225) DEFAULT NULL COMMENT \'Workplace of employee\',
  74.                     work_incapacity_obligations VARCHAR(225) DEFAULT NULL
  75.                         COMMENT \'Work incapacity obligations for employee\',
  76.                     INDEX IDX_25A266CEC2136A18 (case_manager_1_id),
  77.                     INDEX IDX_25A266CED0A6C5F6 (case_manager_2_id),
  78.                     UNIQUE INDEX UNIQ_25A266CEE93E06DC (data_protection_declaration_file_id),
  79.                     INDEX IDX_25A266CE8C03F15C (employee_id),
  80.                     INDEX IDX_25A266CE39C059AC (employee_business_country_id),
  81.                     UNIQUE INDEX UNIQ_25A266CE45261D63 (release_of_confidentiality_case_manager_file_id),
  82.                     UNIQUE INDEX UNIQ_25A266CE329C068F (release_of_confidentiality_occupational_physician_file_id),
  83.                     INDEX IDX_25A266CE6BF700BD (status_id),
  84.                     PRIMARY KEY(id)
  85.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
  86.             '
  87.         );
  88.         $this->addSql(
  89.             '
  90.                 CREATE TABLE oim_conversations (
  91.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
  92.                     oim_case_id INT NOT NULL COMMENT \'Internal ID\',
  93.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
  94.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
  95.                     conversation_notes VARCHAR(225) DEFAULT NULL COMMENT \'Notes of this conversation\',
  96.                     date DATETIME NOT NULL COMMENT \'Date of conversation\',
  97.                     INDEX IDX_9A3B03C8F60F70BA (oim_case_id),
  98.                     PRIMARY KEY(id)
  99.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  100.             '
  101.         );
  102.         $this->addSql(
  103.             '
  104.                 CREATE TABLE oim_case_status (
  105.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
  106.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
  107.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
  108.                     date DATETIME NOT NULL COMMENT \'date of status change\',
  109.                     oim_case_id INT NOT NULL COMMENT \'Internal ID\',
  110.                     INDEX IDX_5DB719F4F60F70BA (oim_case_id),
  111.                     PRIMARY KEY(id)
  112.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  113.             '
  114.         );
  115.         $this->addSql(
  116.             '
  117.                 ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CEC2136A18
  118.                     FOREIGN KEY (case_manager_1_id) REFERENCES user (id);
  119.             '
  120.         );
  121.         $this->addSql(
  122.             '
  123.                 ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CED0A6C5F6
  124.                     FOREIGN KEY (case_manager_2_id) REFERENCES user (id);
  125.             '
  126.         );
  127.         $this->addSql(
  128.             '
  129.                 ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CEE93E06DC
  130.                     FOREIGN KEY (data_protection_declaration_file_id) REFERENCES stored_documents (id);
  131.             '
  132.         );
  133.         $this->addSql(
  134.             '
  135.                 ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CE8C03F15C
  136.                     FOREIGN KEY (employee_id) REFERENCES employee (id);
  137.             '
  138.         );
  139.         $this->addSql(
  140.             '
  141.                 ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CE39C059AC
  142.                     FOREIGN KEY (employee_business_country_id) REFERENCES country (id);
  143.             '
  144.         );
  145.         $this->addSql(
  146.             '
  147.                 ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CE45261D63
  148.                     FOREIGN KEY (release_of_confidentiality_case_manager_file_id) REFERENCES stored_documents (id);
  149.             '
  150.         );
  151.         $this->addSql(
  152.             '
  153.                 ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CE329C068F
  154.                     FOREIGN KEY (release_of_confidentiality_occupational_physician_file_id)
  155.                         REFERENCES stored_documents (id);
  156.             '
  157.         );
  158.         $this->addSql(
  159.             '
  160.                 ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CE6BF700BD
  161.                     FOREIGN KEY (status_id) REFERENCES oim_status (id);
  162.             '
  163.         );
  164.         $this->addSql(
  165.             '
  166.                 ALTER TABLE oim_conversations ADD CONSTRAINT FK_9A3B03C8F60F70BA
  167.                     FOREIGN KEY (oim_case_id) REFERENCES oim_case (id) ON DELETE CASCADE;
  168.             '
  169.         );
  170.         $this->addSql(
  171.             '
  172.                 ALTER TABLE oim_case_status ADD CONSTRAINT FK_5DB719F4F60F70BA FOREIGN KEY
  173.                     (oim_case_id) REFERENCES oim_case (id) ON DELETE CASCADE;
  174.             '
  175.         );
  176.     }
  177.     public function down(Schema $schema): void
  178.     {
  179.         // this down() migration is auto-generated, please modify it to your needs
  180.         $this->addSql('ALTER TABLE oim_conversations DROP FOREIGN KEY FK_9A3B03C8F60F70BA');
  181.         $this->addSql('ALTER TABLE oim_case_status DROP FOREIGN KEY FK_5DB719F4F60F70BA;');
  182.         $this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CEC2136A18');
  183.         $this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CED0A6C5F6');
  184.         $this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CEE93E06DC');
  185.         $this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CE8C03F15C');
  186.         $this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CE39C059AC');
  187.         $this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CE45261D63');
  188.         $this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CE329C068F');
  189.         $this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CE6BF700BD');
  190.         $this->addSql('DROP TABLE oim_conversations');
  191.         $this->addSql('DROP TABLE oim_case_status');
  192.         $this->addSql('DROP TABLE oim_case');
  193.     }
  194. }