<?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 Version20221002153700 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 trip_city (trip_id INT NOT NULL, city_id INT NOT NULL, INDEX IDX_663915FA5BC2E0E (trip_id), INDEX IDX_663915F8BAC62AF (city_id), PRIMARY KEY(trip_id, city_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE trip_city ADD CONSTRAINT FK_663915FA5BC2E0E FOREIGN KEY (trip_id) REFERENCES trip (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE trip_city ADD CONSTRAINT FK_663915F8BAC62AF FOREIGN KEY (city_id) REFERENCES city (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE trip_city DROP FOREIGN KEY FK_663915FA5BC2E0E');
$this->addSql('ALTER TABLE trip_city DROP FOREIGN KEY FK_663915F8BAC62AF');
$this->addSql('DROP TABLE trip_city');
}
}