migrations/Version20241216192125.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 Version20241216192125 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('ALTER TABLE berth_cargo_type DROP FOREIGN KEY FK_A860E985CD33D8BC');
  19.         $this->addSql('ALTER TABLE berth_cargo_type DROP FOREIGN KEY FK_A860E98534832E6');
  20.         $this->addSql('DROP TABLE berth_cargo_type');
  21.         $this->addSql('DROP TABLE cargo_type');
  22.         $this->addSql('ALTER TABLE cargo ADD cargo_type VARCHAR(191) NOT NULL');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('CREATE TABLE berth_cargo_type (berth_id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', cargo_type_id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', INDEX IDX_A860E98534832E6 (berth_id), INDEX IDX_A860E985CD33D8BC (cargo_type_id), PRIMARY KEY(berth_id, cargo_type_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  28.         $this->addSql('CREATE TABLE cargo_type (id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', name VARCHAR(191) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  29.         $this->addSql('ALTER TABLE berth_cargo_type ADD CONSTRAINT FK_A860E985CD33D8BC FOREIGN KEY (cargo_type_id) REFERENCES cargo_type (id) ON UPDATE NO ACTION ON DELETE CASCADE');
  30.         $this->addSql('ALTER TABLE berth_cargo_type ADD CONSTRAINT FK_A860E98534832E6 FOREIGN KEY (berth_id) REFERENCES berth (id) ON UPDATE NO ACTION ON DELETE CASCADE');
  31.         $this->addSql('ALTER TABLE cargo DROP cargo_type');
  32.     }
  33. }