<?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 Version20241217184248 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 owner_vessel DROP FOREIGN KEY FK_EB22F0F614AF1953');
$this->addSql('ALTER TABLE owner_vessel DROP FOREIGN KEY FK_EB22F0F67E3C61F9');
$this->addSql('DROP TABLE owner_vessel');
$this->addSql('ALTER TABLE vessel DROP INDEX UNIQ_4ED8DCA87E3C61F9, ADD INDEX IDX_4ED8DCA87E3C61F9 (owner_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE owner_vessel (owner_id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', vessel_id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', UNIQUE INDEX UNIQ_EB22F0F614AF1953 (vessel_id), INDEX IDX_EB22F0F67E3C61F9 (owner_id), PRIMARY KEY(owner_id, vessel_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE owner_vessel ADD CONSTRAINT FK_EB22F0F614AF1953 FOREIGN KEY (vessel_id) REFERENCES vessel (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('ALTER TABLE owner_vessel ADD CONSTRAINT FK_EB22F0F67E3C61F9 FOREIGN KEY (owner_id) REFERENCES owner (id) ON UPDATE NO ACTION ON DELETE CASCADE');
$this->addSql('ALTER TABLE vessel DROP INDEX IDX_4ED8DCA87E3C61F9, ADD UNIQUE INDEX UNIQ_4ED8DCA87E3C61F9 (owner_id)');
}
}