<?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 Version20220413144206 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 artist ADD idu BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\' AFTER id');
$this->addSql('ALTER TABLE artist_image ADD artist_idu BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\' AFTER artist_id');
$this->addSql('UPDATE artist SET idu=(UNHEX(REPLACE(UUID(), "-","")))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_159968799B902AD ON artist (idu)');
$this->addSql('UPDATE artist_image ai INNER JOIN artist a ON a.id = ai.artist_id SET ai.artist_idu=a.idu');
$this->addSql('ALTER TABLE lineup ADD idu BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\' AFTER id');
$this->addSql('UPDATE lineup SET idu=(UNHEX(REPLACE(UUID(), "-","")))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_CD7E0ECA99B902AD ON lineup (idu)');
$this->addSql('ALTER TABLE news ADD idu BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\' AFTER id');
$this->addSql('ALTER TABLE news_image ADD news_idu BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\' AFTER news_id');
$this->addSql('UPDATE news SET idu=(UNHEX(REPLACE(UUID(), "-","")))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1DD3995099B902AD ON news (idu)');
$this->addSql('UPDATE news_image ai INNER JOIN news a ON a.id = ai.news_id SET ai.news_idu=a.idu');
$this->addSql('ALTER TABLE stage ADD idu BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\' AFTER id');
$this->addSql('ALTER TABLE stage_image ADD stage_idu BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\' AFTER stage_id');
$this->addSql('UPDATE stage SET idu=(UNHEX(REPLACE(UUID(), "-","")))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_C27C936999B902AD ON stage (idu)');
$this->addSql('UPDATE stage_image ai INNER JOIN stage a ON a.id = ai.stage_id SET ai.stage_idu=a.idu');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX UNIQ_159968799B902AD ON artist');
$this->addSql('ALTER TABLE artist DROP idu');
$this->addSql('ALTER TABLE artist_image DROP artist_idu');
$this->addSql('DROP INDEX UNIQ_CD7E0ECA99B902AD ON lineup');
$this->addSql('ALTER TABLE lineup DROP idu');
$this->addSql('DROP INDEX UNIQ_1DD3995099B902AD ON news');
$this->addSql('ALTER TABLE news DROP idu');
$this->addSql('ALTER TABLE news_image DROP news_idu');
$this->addSql('DROP INDEX UNIQ_C27C936999B902AD ON stage');
$this->addSql('ALTER TABLE stage DROP idu');
$this->addSql('ALTER TABLE stage_image DROP stage_idu');
}
}