<?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 Version20221002165616 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 team_trip (team_id INT NOT NULL, trip_id INT NOT NULL, INDEX IDX_A7B70140296CD8AE (team_id), INDEX IDX_A7B70140A5BC2E0E (trip_id), PRIMARY KEY(team_id, trip_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE team_trip ADD CONSTRAINT FK_A7B70140296CD8AE FOREIGN KEY (team_id) REFERENCES team (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE team_trip ADD CONSTRAINT FK_A7B70140A5BC2E0E FOREIGN KEY (trip_id) REFERENCES trip (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE team ADD name VARCHAR(255) NOT NULL, DROP team1, DROP team2');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE team_trip DROP FOREIGN KEY FK_A7B70140296CD8AE');
$this->addSql('ALTER TABLE team_trip DROP FOREIGN KEY FK_A7B70140A5BC2E0E');
$this->addSql('DROP TABLE team_trip');
$this->addSql('ALTER TABLE team ADD team2 VARCHAR(255) NOT NULL, CHANGE name team1 VARCHAR(255) NOT NULL');
}
}