<?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 Version20221209174758 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 event_tour (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(190) NOT NULL, active TINYINT(1) NOT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE event ADD id_tour INT NOT NULL');
$this->addSql('ALTER TABLE professional ADD tour_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE professional ADD CONSTRAINT FK_B3B573AA15ED8D43 FOREIGN KEY (tour_id) REFERENCES event_tour (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_B3B573AA15ED8D43 ON professional (tour_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE `professional` DROP FOREIGN KEY FK_B3B573AA15ED8D43');
$this->addSql('DROP TABLE event_tour');
$this->addSql('ALTER TABLE `event` DROP id_tour');
$this->addSql('DROP INDEX UNIQ_B3B573AA15ED8D43 ON `professional`');
$this->addSql('ALTER TABLE `professional` DROP tour_id');
}
}