<?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 Version20221001050219 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 content ADD event_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('UPDATE content SET event_id=(SELECT id FROM event LIMIT 1)');
$this->addSql('ALTER TABLE content ADD CONSTRAINT FK_FEC530A971F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
$this->addSql('CREATE INDEX IDX_FEC530A971F7E88B ON content (event_id)');
$this->addSql('ALTER TABLE food ADD event_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('UPDATE food SET event_id=(SELECT id FROM event LIMIT 1)');
$this->addSql('ALTER TABLE food ADD CONSTRAINT FK_D43829F771F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
$this->addSql('CREATE INDEX IDX_D43829F771F7E88B ON food (event_id)');
$this->addSql('ALTER TABLE news ADD event_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('UPDATE news SET event_id=(SELECT id FROM event LIMIT 1)');
$this->addSql('ALTER TABLE news ADD CONSTRAINT FK_1DD3995071F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
$this->addSql('CREATE INDEX IDX_1DD3995071F7E88B ON news (event_id)');
$this->addSql('ALTER TABLE stage ADD event_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('UPDATE stage SET event_id=(SELECT id FROM event LIMIT 1)');
$this->addSql('ALTER TABLE stage ADD CONSTRAINT FK_C27C936971F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
$this->addSql('CREATE INDEX IDX_C27C936971F7E88B ON stage (event_id)');
$this->addSql('ALTER TABLE ticket_type CHANGE person person TINYINT(1) NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE content DROP FOREIGN KEY FK_FEC530A971F7E88B');
$this->addSql('DROP INDEX IDX_FEC530A971F7E88B ON content');
$this->addSql('ALTER TABLE content DROP event_id');
$this->addSql('ALTER TABLE food DROP FOREIGN KEY FK_D43829F771F7E88B');
$this->addSql('DROP INDEX IDX_D43829F771F7E88B ON food');
$this->addSql('ALTER TABLE food DROP event_id');
$this->addSql('ALTER TABLE news DROP FOREIGN KEY FK_1DD3995071F7E88B');
$this->addSql('DROP INDEX IDX_1DD3995071F7E88B ON news');
$this->addSql('ALTER TABLE news DROP event_id');
$this->addSql('ALTER TABLE stage DROP FOREIGN KEY FK_C27C936971F7E88B');
$this->addSql('DROP INDEX IDX_C27C936971F7E88B ON stage');
$this->addSql('ALTER TABLE stage DROP event_id');
$this->addSql('ALTER TABLE ticket_type CHANGE person person TINYINT(1) DEFAULT 0 NOT NULL');
}
}