<?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 Version20241216192125 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('ALTER TABLE berth_cargo_type DROP FOREIGN KEY FK_A860E985CD33D8BC');
$this->addSql('ALTER TABLE berth_cargo_type DROP FOREIGN KEY FK_A860E98534832E6');
$this->addSql('DROP TABLE berth_cargo_type');
$this->addSql('DROP TABLE cargo_type');
$this->addSql('ALTER TABLE cargo ADD cargo_type VARCHAR(191) NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$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 = \'\' ');
$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 = \'\' ');
$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');
$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');
$this->addSql('ALTER TABLE cargo DROP cargo_type');
}
}