src/Migrations/Version20210415201957.php line 1

  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 Version20210415201957 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 contacts DROP owner_type, DROP owner_id');
  19.         $this->addSql('ALTER TABLE files DROP owner_type, DROP owner_id');
  20.         $this->addSql('ALTER TABLE forum_thread DROP owner_type, DROP owner_id');
  21.         $this->addSql('DROP INDEX idx_relation ON links');
  22.         $this->addSql('ALTER TABLE links DROP owner_type, DROP owner_id');
  23.         $this->addSql('CREATE INDEX idx_relation ON links (owner_uuid, deleted)');
  24.         $this->addSql('ALTER TABLE material DROP owner_type, DROP owner_id');
  25.         $this->addSql('ALTER TABLE news DROP owner_type, DROP owner_id');
  26.         $this->addSql('ALTER TABLE reviews DROP owner_type, DROP owner_id');
  27.     }
  28.     public function down(Schema $schema): void
  29.     {
  30.         // this down() migration is auto-generated, please modify it to your needs
  31.         $this->addSql('ALTER TABLE contacts ADD owner_type VARCHAR(50) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, ADD owner_id INT DEFAULT NULL');
  32.         $this->addSql('ALTER TABLE files ADD owner_type VARCHAR(50) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, ADD owner_id INT DEFAULT NULL');
  33.         $this->addSql('ALTER TABLE forum_thread ADD owner_type VARCHAR(50) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, ADD owner_id INT DEFAULT NULL');
  34.         $this->addSql('DROP INDEX idx_relation ON links');
  35.         $this->addSql('ALTER TABLE links ADD owner_type VARCHAR(50) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, ADD owner_id INT DEFAULT NULL');
  36.         $this->addSql('CREATE INDEX idx_relation ON links (owner_type, owner_id, deleted)');
  37.         $this->addSql('ALTER TABLE material ADD owner_type VARCHAR(50) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, ADD owner_id INT DEFAULT NULL');
  38.         $this->addSql('ALTER TABLE news ADD owner_type VARCHAR(50) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, ADD owner_id INT DEFAULT NULL');
  39.         $this->addSql('ALTER TABLE reviews ADD owner_type VARCHAR(50) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, ADD owner_id INT DEFAULT NULL');
  40.     }
  41. }