<?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!
*
* @package API
* @internal
*/
final class Version20230926123640 extends AbstractMigration
{
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE ta_report DROP FOREIGN KEY FK_F777692B16D8554C');
$this->addSql('ALTER TABLE ta_report DROP FOREIGN KEY FK_F777692B7D182D95');
$this->addSql('ALTER TABLE ta_report DROP FOREIGN KEY FK_F777692BF3340201');
$this->addSql('ALTER TABLE ta_report DROP FOREIGN KEY FK_F777692BD669FA40');
$this->addSql('ALTER TABLE ta_report DROP FOREIGN KEY FK_F777692B468FF4C');
$this->addSql('DROP TABLE ta_report');
}
public function getDescription(): string
{
return
"- Introduces TA report table.";
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql(
'
CREATE TABLE ta_report (
id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
accident_id INT NOT NULL COMMENT \'Internal ID\',
created_by_user_id INT NOT NULL COMMENT \'Internal ID\',
insured_person_employee_legal_state_id VARCHAR(32) DEFAULT NULL
COMMENT \'Internal employee legal state ID\',
insured_person_gender_id VARCHAR(1) NOT NULL COMMENT \'Internal gender ID\',
insured_person_nationality_id VARCHAR(2) DEFAULT NULL
COMMENT \'Country code in upper case (ISO 3166-1 Alpha-2)\',
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\',
accident_date_time DATETIME NOT NULL COMMENT \'Accident date and time\',
authorized_person_representative_full_name VARCHAR(500) NOT NULL
COMMENT \'Full name of approving authorized person representative\',
company_full_address VARCHAR(1000) NOT NULL COMMENT \'Company full address\',
company_name VARCHAR(225) NOT NULL COMMENT \'Company name\',
company_number VARCHAR(11) NOT NULL COMMENT \'Company number\',
company_phone VARCHAR(225) DEFAULT NULL COMMENT \'Company phone number\',
description TEXT NOT NULL COMMENT \'Description\',
description_issuer_insured_person SMALLINT NOT NULL
COMMENT \'Flag if description issuer was the insured person\',
fatal SMALLINT NOT NULL COMMENT \'Flag if accident was fatal\',
first_aid_full_address VARCHAR(1000) NOT NULL COMMENT \'First aid full address\',
first_person_to_recognize_eyewitness SMALLINT DEFAULT NULL
COMMENT \'Flag if first person to recognize was an eyewitness\',
first_person_to_recognize_full_address VARCHAR(1000) DEFAULT NULL
COMMENT \'First person to recognize full address\',
injured_body_parts VARCHAR(2000) NOT NULL COMMENT \'Translated list of injured body parts\',
injury_types VARCHAR(2000) NOT NULL COMMENT \'Translated list of injury types\',
insured_person_address VARCHAR(225) NOT NULL COMMENT \'Postal address for insured person\',
insured_person_birthday DATE NOT NULL COMMENT \'Insured person birthday\',
insured_person_city VARCHAR(225) NOT NULL COMMENT \'City of address for insured person\',
insured_person_external_worker SMALLINT NOT NULL
COMMENT \'Flag if insured person is an external worker\',
insured_person_full_name VARCHAR(500) NOT NULL COMMENT \'Insured person full name\',
insured_person_health_insurance_provider_full_address VARCHAR(1000) NOT NULL
COMMENT \'Insured person health insurance provider full address\',
insured_person_job_entry_date DATE DEFAULT NULL COMMENT \'Insured person job entry date\',
insured_person_job_title VARCHAR(225) DEFAULT NULL COMMENT \'Insured person job title\',
insured_person_org_unit_name VARCHAR(225) NOT NULL COMMENT \'Insured person org unit name\',
insured_person_restarted_working_date DATE DEFAULT NULL
COMMENT \'Date when insured person restarted working\',
insured_person_stopped_working SMALLINT NOT NULL
COMMENT \'Flag if insured person stopped working after accident\',
insured_person_stopped_working_date_time DATETIME DEFAULT NULL
COMMENT \'Date and time when insured person stopped working\',
insured_person_trainee SMALLINT NOT NULL COMMENT \'Flag if insured person is a trainee\',
insured_person_weeks_sick_leave INT NOT NULL COMMENT \'Weeks of sick leave for insured person\',
insured_person_work_ending_time TIME NOT NULL COMMENT \'Work ending time of insured person\',
insured_person_work_starting_time TIME NOT NULL COMMENT \'Work starting time of insured person\',
insured_person_zip_code VARCHAR(16) NOT NULL COMMENT \'Zip code of address for insured person\',
place VARCHAR(1000) NOT NULL COMMENT \'Place\',
receiver_full_address VARCHAR(1000) NOT NULL COMMENT \'Receiver full address\',
receiver_name VARCHAR(225) NOT NULL COMMENT \'Receiver name\',
work_council_representative_full_name VARCHAR(500) DEFAULT NULL
COMMENT \'Full name of approving work council representative\',
UNIQUE INDEX UNIQ_F777692B16D8554C (accident_id),
INDEX IDX_F777692B7D182D95 (created_by_user_id),
INDEX IDX_F777692BF3340201 (insured_person_employee_legal_state_id),
INDEX IDX_F777692BD669FA40 (insured_person_gender_id),
INDEX IDX_F777692B468FF4C (insured_person_nationality_id),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
'
);
$this->addSql(
'
ALTER TABLE ta_report ADD CONSTRAINT FK_F777692B16D8554C
FOREIGN KEY (accident_id) REFERENCES accident (id) ON DELETE CASCADE
'
);
$this->addSql(
'
ALTER TABLE ta_report ADD CONSTRAINT FK_F777692B7D182D95
FOREIGN KEY (created_by_user_id) REFERENCES user (id)
'
);
$this->addSql(
'
ALTER TABLE ta_report ADD CONSTRAINT FK_F777692BF3340201
FOREIGN KEY (insured_person_employee_legal_state_id) REFERENCES employee_legal_state (id)
'
);
$this->addSql(
'
ALTER TABLE ta_report ADD CONSTRAINT FK_F777692BD669FA40
FOREIGN KEY (insured_person_gender_id) REFERENCES gender (id)
'
);
$this->addSql(
'
ALTER TABLE ta_report ADD CONSTRAINT FK_F777692B468FF4C
FOREIGN KEY (insured_person_nationality_id) REFERENCES country (id)
'
);
}
}