<?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 Version20250413153549 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 sob_reason (
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',
last_active_date DATE DEFAULT NULL COMMENT 'Last active date',
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
"
);
$this->addSql(
"
CREATE TABLE sob_reason_l10n (
parent_entity_id INT NOT NULL COMMENT 'Internal ID',
language_id VARCHAR(2) NOT NULL COMMENT 'Language code in lower case (ISO 639-1)',
name VARCHAR(225) DEFAULT NULL COMMENT 'Reason name in referenced language',
INDEX IDX_16EAB29B706E52B3 (parent_entity_id),
INDEX IDX_16EAB29B82F1BAF4 (language_id),
PRIMARY KEY(parent_entity_id, language_id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
"
);
$this->addSql(
"
ALTER TABLE sob_reason_l10n ADD CONSTRAINT FK_16EAB29B706E52B3 FOREIGN KEY
(parent_entity_id) REFERENCES sob_reason (id) ON DELETE CASCADE
"
);
$this->addSql(
"
ALTER TABLE sob_reason_l10n ADD CONSTRAINT FK_16EAB29B82F1BAF4 FOREIGN KEY
(language_id) REFERENCES language (id) ON DELETE CASCADE
"
);
$created = time();
$this->addSql(
'
INSERT INTO sob_reason
(id, created, active)
VALUES
(1, :createdTimeStamp, 1),
(2, :createdTimeStamp, 1),
(3, :createdTimeStamp, 1),
(4, :createdTimeStamp, 1),
(5, :createdTimeStamp, 1),
(6, :createdTimeStamp, 1),
(7, :createdTimeStamp, 1),
(8, :createdTimeStamp, 1),
(9, :createdTimeStamp, 1),
(10, :createdTimeStamp, 1),
(11, :createdTimeStamp, 1),
(12, :createdTimeStamp, 1)
;
',
['createdTimeStamp' => $created]
);
$this->addSql(
'
INSERT INTO sob_reason_l10n
(language_id, parent_entity_id, name)
VALUES
(\'de\', 1, \'Abhängigkeit/Missbrauch\'),
(\'de\', 2, \'Arbeitseinsatz\'),
(\'de\', 3, \'Arbeitsleistung/-qualität\'),
(\'de\', 4, \'Arbeitsplatz\'),
(\'de\', 5, \'Arbeitssicherheit\'),
(\'de\', 6, \'Burnout\'),
(\'de\', 7, \'Arbeitsüberlastung\'),
(\'de\', 8, \'Fehlzeiten\'),
(\'de\', 9, \'Konflikte am Arbeitsplatz\'),
(\'de\', 10, \'Persönliche Themen\'),
(\'de\', 11, \'Schichtarbeit\'),
(\'de\', 12, \'Psychische Themen\'),
(\'en\', 1, \'Substance Abuse\'),
(\'en\', 2, \'Job Assignment\'),
(\'en\', 3, \'Work Performance and Quality\'),
(\'en\', 4, \'Workplace\'),
(\'en\', 5, \'Safety at Work\'),
(\'en\', 6, \'Burnout\'),
(\'en\', 7, \'Workload & Overload\'),
(\'en\', 8, \'Absence\'),
(\'en\', 9, \'Conflicts\'),
(\'en\', 10, \'Personal Issues\'),
(\'en\', 11, \'Shift Work\'),
(\'en\', 12, \'Mental and Psychological Issues\')
;
'
);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql(
"
ALTER TABLE sob_reason_l10n DROP FOREIGN KEY FK_16EAB29B706E52B3
"
);
$this->addSql(
"
ALTER TABLE sob_reason_l10n DROP FOREIGN KEY FK_16EAB29B82F1BAF4
"
);
$this->addSql(
"
DROP TABLE sob_reason
"
);
$this->addSql(
"
DROP TABLE sob_reason_l10n
"
);
}
}