migrations/Version20260324140000.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20260324140000 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql(
  19.             '
  20.                 CREATE TABLE cmr_estimate (
  21.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\', 
  22.                     exposure_id INT NOT NULL COMMENT \'Internal ID\', 
  23.                     qualitative_information_id INT NOT NULL COMMENT \'Internal ID\', 
  24.                     exposure_site_id INT NOT NULL COMMENT \'Internal ID\', 
  25.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\', 
  26.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\', 
  27.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\', 
  28.                     date DATETIME NOT NULL COMMENT \'Date\', 
  29.                     other_qualitative_information VARCHAR(255) DEFAULT NULL COMMENT \'Other qualitative information\', 
  30.                     source VARCHAR(255) NOT NULL COMMENT \'Source\', 
  31.                     notes TINYTEXT DEFAULT NULL COMMENT \'Notes\', 
  32.                     created_by_id INT NOT NULL COMMENT \'Internal ID\', 
  33.                     updated_by_id INT DEFAULT NULL COMMENT \'Internal ID\',
  34.                     INDEX IDX_CMR_ESTIMATE_EXPOSURE_ID (exposure_id), 
  35.                     INDEX IDX_CMR_ESTIMATE_QUALITATIVE_INFORMATION_ID (qualitative_information_id), 
  36.                     INDEX IDX_CMR_ESTIMATE_EXPOSURE_SITE_ID (exposure_site_id), 
  37.                     INDEX IDX_57C6E1C4DE12AB56 (created_by_id), 
  38.                     INDEX IDX_57C6E1C416FE72E1 (updated_by_id), 
  39.                     PRIMARY KEY(id)
  40.                 ) 
  41.                 DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  42.             '
  43.         );
  44.         $this->addSql(
  45.             '
  46.                 ALTER TABLE cmr_estimate ADD CONSTRAINT FK_CMR_ESTIMATE_EXPOSURE_ID FOREIGN KEY 
  47.                     (exposure_id) REFERENCES cmr_exposure (id) ON DELETE CASCADE
  48.             '
  49.         );
  50.         $this->addSql(
  51.             '
  52.                 ALTER TABLE cmr_estimate ADD CONSTRAINT FK_CMR_ESTIMATE_QUALITATIVE_INFORMATION_ID FOREIGN KEY 
  53.                     (qualitative_information_id) REFERENCES cmr_qualitative_information (id)
  54.             '
  55.         );
  56.         $this->addSql(
  57.             '
  58.                 ALTER TABLE cmr_estimate ADD CONSTRAINT FK_CMR_ESTIMATE_EXPOSURE_SITE_ID FOREIGN KEY 
  59.                     (exposure_site_id) REFERENCES cmr_exposure_site (id)
  60.             '
  61.         );
  62.         $this->addSql(
  63.             '
  64.                 ALTER TABLE cmr_estimate ADD CONSTRAINT FK_57C6E1C4DE12AB56 FOREIGN KEY 
  65.                     (created_by_id) REFERENCES user (id)
  66.             '
  67.         );
  68.         $this->addSql(
  69.             '
  70.                 ALTER TABLE cmr_estimate ADD CONSTRAINT FK_57C6E1C416FE72E1 FOREIGN KEY 
  71.                     (updated_by_id) REFERENCES user (id)
  72.             '
  73.         );
  74.     }
  75.     public function down(Schema $schema): void
  76.     {
  77.         // this down() migration is auto-generated, please modify it to your needs
  78.         $this->addSql('ALTER TABLE cmr_estimate DROP FOREIGN KEY FK_CMR_ESTIMATE_EXPOSURE_ID');
  79.         $this->addSql('ALTER TABLE cmr_estimate DROP FOREIGN KEY FK_CMR_ESTIMATE_QUALITATIVE_INFORMATION_ID');
  80.         $this->addSql('ALTER TABLE cmr_estimate DROP FOREIGN KEY FK_CMR_ESTIMATE_EXPOSURE_SITE_ID');
  81.         $this->addSql('DROP TABLE cmr_estimate');
  82.     }
  83. }