migrations/Version20250602182508.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 Version20250602182508 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('CREATE TABLE reported_incident (id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', contract_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', category VARCHAR(191) NOT NULL, subcategory VARCHAR(191) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_17CB030B2576E0FD (contract_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE reported_port (id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', port_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', contract_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_DFD119A676E92A9C (port_id), INDEX IDX_DFD119A62576E0FD (contract_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE reported_incident ADD CONSTRAINT FK_17CB030B2576E0FD FOREIGN KEY (contract_id) REFERENCES contract (id)');
  21.         $this->addSql('ALTER TABLE reported_port ADD CONSTRAINT FK_DFD119A676E92A9C FOREIGN KEY (port_id) REFERENCES port (id)');
  22.         $this->addSql('ALTER TABLE reported_port ADD CONSTRAINT FK_DFD119A62576E0FD FOREIGN KEY (contract_id) REFERENCES contract (id)');
  23.         $this->addSql('ALTER TABLE contract ADD report_description LONGTEXT DEFAULT NULL, ADD vessel_arrived_within_the_laycan TINYINT(1) DEFAULT NULL, ADD vessel_was_substituted TINYINT(1) DEFAULT NULL, ADD addendum_issued TINYINT(1) DEFAULT NULL, ADD addendum_description LONGTEXT DEFAULT NULL');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('ALTER TABLE reported_incident DROP FOREIGN KEY FK_17CB030B2576E0FD');
  29.         $this->addSql('ALTER TABLE reported_port DROP FOREIGN KEY FK_DFD119A676E92A9C');
  30.         $this->addSql('ALTER TABLE reported_port DROP FOREIGN KEY FK_DFD119A62576E0FD');
  31.         $this->addSql('DROP TABLE reported_incident');
  32.         $this->addSql('DROP TABLE reported_port');
  33.         $this->addSql('ALTER TABLE contract DROP report_description, DROP vessel_arrived_within_the_laycan, DROP vessel_was_substituted, DROP addendum_issued, DROP addendum_description');
  34.     }
  35. }