<?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 Version20260324140000 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_estimate (
id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
exposure_id INT NOT NULL COMMENT \'Internal ID\',
qualitative_information_id INT NOT NULL COMMENT \'Internal ID\',
exposure_site_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\',
date DATETIME NOT NULL COMMENT \'Date\',
other_qualitative_information VARCHAR(255) DEFAULT NULL COMMENT \'Other qualitative information\',
source VARCHAR(255) NOT NULL COMMENT \'Source\',
notes TINYTEXT DEFAULT NULL COMMENT \'Notes\',
created_by_id INT NOT NULL COMMENT \'Internal ID\',
updated_by_id INT DEFAULT NULL COMMENT \'Internal ID\',
INDEX IDX_CMR_ESTIMATE_EXPOSURE_ID (exposure_id),
INDEX IDX_CMR_ESTIMATE_QUALITATIVE_INFORMATION_ID (qualitative_information_id),
INDEX IDX_CMR_ESTIMATE_EXPOSURE_SITE_ID (exposure_site_id),
INDEX IDX_57C6E1C4DE12AB56 (created_by_id),
INDEX IDX_57C6E1C416FE72E1 (updated_by_id),
PRIMARY KEY(id)
)
DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
'
);
$this->addSql(
'
ALTER TABLE cmr_estimate ADD CONSTRAINT FK_CMR_ESTIMATE_EXPOSURE_ID FOREIGN KEY
(exposure_id) REFERENCES cmr_exposure (id) ON DELETE CASCADE
'
);
$this->addSql(
'
ALTER TABLE cmr_estimate ADD CONSTRAINT FK_CMR_ESTIMATE_QUALITATIVE_INFORMATION_ID FOREIGN KEY
(qualitative_information_id) REFERENCES cmr_qualitative_information (id)
'
);
$this->addSql(
'
ALTER TABLE cmr_estimate ADD CONSTRAINT FK_CMR_ESTIMATE_EXPOSURE_SITE_ID FOREIGN KEY
(exposure_site_id) REFERENCES cmr_exposure_site (id)
'
);
$this->addSql(
'
ALTER TABLE cmr_estimate ADD CONSTRAINT FK_57C6E1C4DE12AB56 FOREIGN KEY
(created_by_id) REFERENCES user (id)
'
);
$this->addSql(
'
ALTER TABLE cmr_estimate ADD CONSTRAINT FK_57C6E1C416FE72E1 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_estimate DROP FOREIGN KEY FK_CMR_ESTIMATE_EXPOSURE_ID');
$this->addSql('ALTER TABLE cmr_estimate DROP FOREIGN KEY FK_CMR_ESTIMATE_QUALITATIVE_INFORMATION_ID');
$this->addSql('ALTER TABLE cmr_estimate DROP FOREIGN KEY FK_CMR_ESTIMATE_EXPOSURE_SITE_ID');
$this->addSql('DROP TABLE cmr_estimate');
}
}