<?php
/* @noinspection PhpUnused */
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 Version20230503081204 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 oim_case (
id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
case_manager_1_id INT NOT NULL COMMENT \'Internal ID\',
case_manager_2_id INT DEFAULT NULL COMMENT \'Internal ID\',
data_protection_declaration_file_id INT DEFAULT NULL COMMENT \'Internal ID\',
employee_id INT NOT NULL COMMENT \'Internal ID\',
employee_business_country_id VARCHAR(2) DEFAULT NULL
COMMENT \'Country code in upper case (ISO 3166-1 Alpha-2)\',
release_of_confidentiality_case_manager_file_id INT DEFAULT NULL COMMENT \'Internal ID\',
release_of_confidentiality_occupational_physician_file_id INT DEFAULT NULL COMMENT \'Internal ID\',
status_id INT DEFAULT NULL COMMENT \'Internal ID\',
created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
last_active_date DATE DEFAULT NULL COMMENT \'Last active date\',
accepted SMALLINT NOT NULL COMMENT \'Flag if employee has accepted the case\',
briefing_date DATETIME DEFAULT NULL COMMENT \'Briefing date\',
briefing_notes TEXT DEFAULT NULL COMMENT \'Briefing notes\',
completion_date DATETIME DEFAULT NULL COMMENT \'Date of completion for the OIM case\',
contract_type VARCHAR(225) DEFAULT NULL COMMENT \'Contract type for employee\',
data_protection_declaration_signed_date DATETIME DEFAULT NULL
COMMENT \'Date protection declaration signed date\',
degree_of_disability INT NOT NULL COMMENT \'Employee\'\'s degree of disability in percent\',
employee_business_address VARCHAR(225) DEFAULT NULL COMMENT \'Business address for employee\',
employee_business_city VARCHAR(225) DEFAULT NULL COMMENT \'Business city for employee\',
employee_business_phone VARCHAR(225) DEFAULT NULL COMMENT \'Business phone number for employee\',
employee_business_zip_code VARCHAR(16) DEFAULT NULL COMMENT \'Business zip code for employee\',
employee_working_at_case_start SMALLINT NOT NULL
COMMENT \'Employee is working at start of OIM case\',
expected_duration VARCHAR(32) DEFAULT NULL COMMENT \'Expected duration\',
letter_of_invitation_1_date DATETIME DEFAULT NULL COMMENT \'Date of first invitation letter\',
letter_of_invitation_1_reply_date DATETIME DEFAULT NULL
COMMENT \'Date of reply for first invitation letter\',
letter_of_invitation_2_date DATETIME DEFAULT NULL COMMENT \'Date of second invitation letter\',
letter_of_invitation_2_reply_date DATETIME DEFAULT NULL
COMMENT \'Date of reply for second invitation letter\',
letter_of_invitation_3_date DATETIME DEFAULT NULL COMMENT \'Date of third invitation letter\',
letter_of_invitation_3_reply_date DATETIME DEFAULT NULL
COMMENT \'Date of reply for third invitation letter\',
occupational_physician_involved SMALLINT NOT NULL
COMMENT \'Flag if an occupational physician is involved in the case\',
release_of_confidentiality_case_manager_signed_date DATETIME DEFAULT NULL
COMMENT \'Release of confidentiality case manager signed date\',
release_of_confidentiality_occupational_physician_signed_date DATETIME DEFAULT NULL
COMMENT \'Release of confidentiality occupational physician signed date\',
representatives_for_disabled_employees_involved SMALLINT DEFAULT NULL
COMMENT \'Flag for the involvement of representatives for disabled employees\',
shift_schedule VARCHAR(225) DEFAULT NULL COMMENT \'Shift schedule for employee\',
separation_date DATETIME DEFAULT NULL COMMENT \'Separation date of employee\',
sick_leave_ratio VARCHAR(255) NOT NULL COMMENT \'Sick leave ratio for employee\',
successful SMALLINT DEFAULT NULL COMMENT \'Flag if case ended successfully\',
trusted_person_full_address VARCHAR(1000) DEFAULT NULL COMMENT \'Trusted person full address\',
trusted_person_full_name VARCHAR(500) DEFAULT NULL COMMENT \'Trusted person full name\',
workplace VARCHAR(225) DEFAULT NULL COMMENT \'Workplace of employee\',
work_incapacity_obligations VARCHAR(225) DEFAULT NULL
COMMENT \'Work incapacity obligations for employee\',
INDEX IDX_25A266CEC2136A18 (case_manager_1_id),
INDEX IDX_25A266CED0A6C5F6 (case_manager_2_id),
UNIQUE INDEX UNIQ_25A266CEE93E06DC (data_protection_declaration_file_id),
INDEX IDX_25A266CE8C03F15C (employee_id),
INDEX IDX_25A266CE39C059AC (employee_business_country_id),
UNIQUE INDEX UNIQ_25A266CE45261D63 (release_of_confidentiality_case_manager_file_id),
UNIQUE INDEX UNIQ_25A266CE329C068F (release_of_confidentiality_occupational_physician_file_id),
INDEX IDX_25A266CE6BF700BD (status_id),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
'
);
$this->addSql(
'
CREATE TABLE oim_conversations (
id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
oim_case_id INT NOT NULL COMMENT \'Internal ID\',
created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
conversation_notes VARCHAR(225) DEFAULT NULL COMMENT \'Notes of this conversation\',
date DATETIME NOT NULL COMMENT \'Date of conversation\',
INDEX IDX_9A3B03C8F60F70BA (oim_case_id),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
'
);
$this->addSql(
'
CREATE TABLE oim_case_status (
id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
date DATETIME NOT NULL COMMENT \'date of status change\',
oim_case_id INT NOT NULL COMMENT \'Internal ID\',
INDEX IDX_5DB719F4F60F70BA (oim_case_id),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
'
);
$this->addSql(
'
ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CEC2136A18
FOREIGN KEY (case_manager_1_id) REFERENCES user (id);
'
);
$this->addSql(
'
ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CED0A6C5F6
FOREIGN KEY (case_manager_2_id) REFERENCES user (id);
'
);
$this->addSql(
'
ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CEE93E06DC
FOREIGN KEY (data_protection_declaration_file_id) REFERENCES stored_documents (id);
'
);
$this->addSql(
'
ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CE8C03F15C
FOREIGN KEY (employee_id) REFERENCES employee (id);
'
);
$this->addSql(
'
ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CE39C059AC
FOREIGN KEY (employee_business_country_id) REFERENCES country (id);
'
);
$this->addSql(
'
ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CE45261D63
FOREIGN KEY (release_of_confidentiality_case_manager_file_id) REFERENCES stored_documents (id);
'
);
$this->addSql(
'
ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CE329C068F
FOREIGN KEY (release_of_confidentiality_occupational_physician_file_id)
REFERENCES stored_documents (id);
'
);
$this->addSql(
'
ALTER TABLE oim_case ADD CONSTRAINT FK_25A266CE6BF700BD
FOREIGN KEY (status_id) REFERENCES oim_status (id);
'
);
$this->addSql(
'
ALTER TABLE oim_conversations ADD CONSTRAINT FK_9A3B03C8F60F70BA
FOREIGN KEY (oim_case_id) REFERENCES oim_case (id) ON DELETE CASCADE;
'
);
$this->addSql(
'
ALTER TABLE oim_case_status ADD CONSTRAINT FK_5DB719F4F60F70BA FOREIGN KEY
(oim_case_id) REFERENCES oim_case (id) ON DELETE CASCADE;
'
);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE oim_conversations DROP FOREIGN KEY FK_9A3B03C8F60F70BA');
$this->addSql('ALTER TABLE oim_case_status DROP FOREIGN KEY FK_5DB719F4F60F70BA;');
$this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CEC2136A18');
$this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CED0A6C5F6');
$this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CEE93E06DC');
$this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CE8C03F15C');
$this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CE39C059AC');
$this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CE45261D63');
$this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CE329C068F');
$this->addSql('ALTER TABLE oim_case DROP FOREIGN KEY FK_25A266CE6BF700BD');
$this->addSql('DROP TABLE oim_conversations');
$this->addSql('DROP TABLE oim_case_status');
$this->addSql('DROP TABLE oim_case');
}
}