<?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 Version20260204120922 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 cmr_case (
id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
employee_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\',
last_active_date DATE DEFAULT NULL COMMENT \'Last active date\',
rv_number VARCHAR(12) DEFAULT NULL COMMENT \'Employee\'\'s RV number\',
country_id VARCHAR(2) DEFAULT NULL COMMENT \'Country code in upper case (ISO 3166-1 Alpha-2)\',
civil_servant_or_student SMALLINT NOT NULL COMMENT \'Flag indicating whether the case is for a civil servant or student.\',
activity_code VARCHAR(225) NOT NULL COMMENT \'Activity code BfA\',
report_to_odin SMALLINT DEFAULT NULL COMMENT \'Flag indicating whether the case should be reported to Odin.\',
report_to_gvs SMALLINT DEFAULT NULL COMMENT \'Flag indicating whether the case should be reported to GVS.\',
address VARCHAR(225) NOT NULL COMMENT \'Address of the employee assigned to the CMR case\',
city VARCHAR(225) NOT NULL COMMENT \'City of the employee assigned to the CMR case\',
zip_code VARCHAR(16) NOT NULL COMMENT \'Zip code of the employee assigned to the CMR case\',
phone VARCHAR(225) DEFAULT NULL COMMENT \'Phone number\',
created_by_id INT NOT NULL COMMENT \'Internal ID\',
updated_by_id INT DEFAULT NULL COMMENT \'Internal ID\',
UNIQUE INDEX UNIQ_74C2E7DC8C03F15C (employee_id),
UNIQUE INDEX UNIQ_74C2E7DCA0AC4043 (rv_number),
INDEX IDX_74C2E7DCF92F3E70 (country_id),
INDEX IDX_74C2E7DCDE12AB56 (created_by_id),
INDEX IDX_74C2E7DC16FE72E1 (updated_by_id),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
'
);
$this->addSql(
'
ALTER TABLE cmr_case ADD CONSTRAINT FK_74C2E7DC8C03F15C FOREIGN KEY
(employee_id) REFERENCES employee (id)
'
);
$this->addSql(
'
ALTER TABLE cmr_case ADD CONSTRAINT FK_74C2E7DCF92F3E70 FOREIGN KEY
(country_id) REFERENCES country (id) ON DELETE SET NULL
'
);
$this->addSql(
'
ALTER TABLE cmr_case ADD CONSTRAINT FK_74C2E7DCDE12AB56 FOREIGN KEY
(created_by_id) REFERENCES user (id)
'
);
$this->addSql(
'
ALTER TABLE cmr_case ADD CONSTRAINT FK_74C2E7DC16FE72E1 FOREIGN KEY
(updated_by_id) REFERENCES user (id)
'
);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE cmr_case DROP FOREIGN KEY FK_74C2E7DC8C03F15C');
$this->addSql('ALTER TABLE cmr_case DROP FOREIGN KEY FK_74C2E7DCF92F3E70');
$this->addSql('ALTER TABLE cmr_case DROP FOREIGN KEY FK_74C2E7DCDE12AB56');
$this->addSql('DROP TABLE cmr_case');
}
}