<?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 Version20230505090121 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_measure_category (
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 oim_measure_category_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 \'Measure category name in referenced language\',
INDEX IDX_B49D7E35706E52B3 (parent_entity_id),
INDEX IDX_B49D7E3582F1BAF4 (language_id),
PRIMARY KEY(parent_entity_id, language_id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
'
);
$this->addSql(
'
CREATE TABLE oim_measure (
id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
category_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\',
INDEX IDX_B918BD6A12469DE2 (category_id),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
'
);
$this->addSql(
'
CREATE TABLE oim_measure_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 \'Measure name in referenced language\',
INDEX IDX_46DC0C25706E52B3 (parent_entity_id),
INDEX IDX_46DC0C2582F1BAF4 (language_id),
PRIMARY KEY(parent_entity_id, language_id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
'
);
$this->addSql(
'
CREATE TABLE oim_measures (
id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
oim_case_id INT NOT NULL COMMENT \'Internal ID\',
social_security_agency_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\',
description VARCHAR(225) NOT NULL COMMENT \'description of this measure\',
date_from DATETIME DEFAULT NULL COMMENT \'start date of measure\',
date_to DATETIME DEFAULT NULL COMMENT \'end date of measure\',
finish_comment VARCHAR(225) NOT NULL COMMENT \'comment after finished measure\',
INDEX IDX_B6D05FF0F60F70BA (oim_case_id),
INDEX IDX_B6D05FF0F6023175 (social_security_agency_id),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
'
);
$this->addSql(
'
ALTER TABLE oim_measure_category_l10n ADD CONSTRAINT FK_B49D7E35706E52B3 FOREIGN KEY
(parent_entity_id) REFERENCES oim_measure_category (id) ON DELETE CASCADE;
'
);
$this->addSql(
'
ALTER TABLE oim_measure_category_l10n ADD CONSTRAINT FK_B49D7E3582F1BAF4 FOREIGN KEY
(language_id) REFERENCES language (id) ON DELETE CASCADE;
'
);
$this->addSql(
'
ALTER TABLE oim_measure ADD CONSTRAINT FK_B918BD6A12469DE2 FOREIGN KEY
(category_id) REFERENCES oim_measure_category (id);
'
);
$this->addSql(
'
ALTER TABLE oim_measure_l10n ADD CONSTRAINT FK_46DC0C25706E52B3 FOREIGN KEY
(parent_entity_id) REFERENCES oim_measure (id) ON DELETE CASCADE;
'
);
$this->addSql(
'
ALTER TABLE oim_measure_l10n ADD CONSTRAINT FK_46DC0C2582F1BAF4 FOREIGN KEY
(language_id) REFERENCES language (id) ON DELETE CASCADE;
'
);
$this->addSql(
'
ALTER TABLE oim_measures ADD CONSTRAINT FK_B6D05FF0F60F70BA
FOREIGN KEY (oim_case_id) REFERENCES oim_case (id) ON DELETE CASCADE;
'
);
$this->addSql(
'
ALTER TABLE oim_measures ADD CONSTRAINT FK_B6D05FF0F6023175 FOREIGN KEY
(social_security_agency_id) REFERENCES social_security_agency (id)
'
);
$this->addSql(
'
ALTER TABLE oim_conversations CHANGE conversation_notes
conversation_notes VARCHAR(225) NOT NULL COMMENT \'Notes of this conversation\'
'
);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE oim_measure_category_l10n DROP FOREIGN KEY FK_B49D7E35706E52B3');
$this->addSql('ALTER TABLE oim_measure_category_l10n DROP FOREIGN KEY FK_B49D7E3582F1BAF4');
$this->addSql('ALTER TABLE oim_measure DROP FOREIGN KEY FK_B918BD6A12469DE2');
$this->addSql('ALTER TABLE oim_measure_l10n DROP FOREIGN KEY FK_46DC0C25706E52B3');
$this->addSql('ALTER TABLE oim_measure_l10n DROP FOREIGN KEY FK_46DC0C2582F1BAF4');
$this->addSql('ALTER TABLE oim_measures DROP FOREIGN KEY FK_B6D05FF0F60F70BA');
$this->addSql('ALTER TABLE oim_measures DROP FOREIGN KEY FK_B6D05FF0F6023175');
$this->addSql('DROP TABLE oim_measure_l10n');
$this->addSql('DROP TABLE oim_measure');
$this->addSql('DROP TABLE oim_measure_category_l10n');
$this->addSql('DROP TABLE oim_measure_category');
$this->addSql('DROP TABLE oim_measures');
$this->addSql(
'
ALTER TABLE oim_conversations CHANGE conversation_notes
conversation_notes VARCHAR(225) DEFAULT NULL COMMENT \'Notes of this conversation\'
'
);
}
}