<?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 Version20250220162624 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('CREATE TABLE port_call (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)\', port_call_type VARCHAR(255) NOT NULL, arrival DATETIME NOT NULL, berthing DATETIME NOT NULL, departure DATETIME NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_A3AC438176E92A9C (port_id), INDEX IDX_A3AC43812576E0FD (contract_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE port_call ADD CONSTRAINT FK_A3AC438176E92A9C FOREIGN KEY (port_id) REFERENCES port (id)');
$this->addSql('ALTER TABLE port_call ADD CONSTRAINT FK_A3AC43812576E0FD FOREIGN KEY (contract_id) REFERENCES contract (id)');
$this->addSql('ALTER TABLE contract_port DROP FOREIGN KEY FK_2BE413A42576E0FD');
$this->addSql('ALTER TABLE contract_port DROP FOREIGN KEY FK_2BE413A476E92A9C');
$this->addSql('DROP TABLE contract_port');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE contract_port (contract_id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', port_id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', UNIQUE INDEX UNIQ_2BE413A476E92A9C (port_id), INDEX IDX_2BE413A42576E0FD (contract_id), PRIMARY KEY(contract_id, port_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE contract_port ADD CONSTRAINT FK_2BE413A42576E0FD FOREIGN KEY (contract_id) REFERENCES contract (id) ON UPDATE NO ACTION ON DELETE CASCADE');
$this->addSql('ALTER TABLE contract_port ADD CONSTRAINT FK_2BE413A476E92A9C FOREIGN KEY (port_id) REFERENCES port (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('ALTER TABLE port_call DROP FOREIGN KEY FK_A3AC438176E92A9C');
$this->addSql('ALTER TABLE port_call DROP FOREIGN KEY FK_A3AC43812576E0FD');
$this->addSql('DROP TABLE port_call');
}
}