migrations/Version20220413144206.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20220413144206 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('ALTER TABLE artist ADD idu BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\' AFTER id');
  19.         $this->addSql('ALTER TABLE artist_image ADD artist_idu BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\' AFTER artist_id');
  20.         $this->addSql('UPDATE artist SET idu=(UNHEX(REPLACE(UUID(), "-","")))');
  21.         $this->addSql('CREATE UNIQUE INDEX UNIQ_159968799B902AD ON artist (idu)');
  22.         $this->addSql('UPDATE artist_image ai INNER JOIN artist a ON  a.id = ai.artist_id SET ai.artist_idu=a.idu');
  23.         $this->addSql('ALTER TABLE lineup ADD idu BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\' AFTER id');
  24.         $this->addSql('UPDATE lineup SET idu=(UNHEX(REPLACE(UUID(), "-","")))');
  25.         $this->addSql('CREATE UNIQUE INDEX UNIQ_CD7E0ECA99B902AD ON lineup (idu)');
  26.         $this->addSql('ALTER TABLE news ADD idu BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\' AFTER id');
  27.         $this->addSql('ALTER TABLE news_image ADD news_idu BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\' AFTER news_id');
  28.         $this->addSql('UPDATE news SET idu=(UNHEX(REPLACE(UUID(), "-","")))');
  29.         $this->addSql('CREATE UNIQUE INDEX UNIQ_1DD3995099B902AD ON news (idu)');
  30.         $this->addSql('UPDATE news_image ai INNER JOIN news a ON  a.id = ai.news_id SET ai.news_idu=a.idu');
  31.         $this->addSql('ALTER TABLE stage ADD idu BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\' AFTER id');
  32.         $this->addSql('ALTER TABLE stage_image ADD stage_idu BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\' AFTER stage_id');
  33.         $this->addSql('UPDATE stage SET idu=(UNHEX(REPLACE(UUID(), "-","")))');
  34.         $this->addSql('CREATE UNIQUE INDEX UNIQ_C27C936999B902AD ON stage (idu)');
  35.         $this->addSql('UPDATE stage_image ai INNER JOIN stage a ON  a.id = ai.stage_id SET ai.stage_idu=a.idu');
  36.     }
  37.     public function down(Schema $schema): void
  38.     {
  39.         // this down() migration is auto-generated, please modify it to your needs
  40.         $this->addSql('DROP INDEX UNIQ_159968799B902AD ON artist');
  41.         $this->addSql('ALTER TABLE artist DROP idu');
  42.         $this->addSql('ALTER TABLE artist_image DROP artist_idu');
  43.         $this->addSql('DROP INDEX UNIQ_CD7E0ECA99B902AD ON lineup');
  44.         $this->addSql('ALTER TABLE lineup DROP idu');
  45.         $this->addSql('DROP INDEX UNIQ_1DD3995099B902AD ON news');
  46.         $this->addSql('ALTER TABLE news DROP idu');
  47.         $this->addSql('ALTER TABLE news_image DROP news_idu');
  48.         $this->addSql('DROP INDEX UNIQ_C27C936999B902AD ON stage');
  49.         $this->addSql('ALTER TABLE stage DROP idu');
  50.         $this->addSql('ALTER TABLE stage_image DROP stage_idu');
  51.     }
  52. }