migrations/Version20211206101915.php line 1

Open in your IDE?
  1. <?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 Version20211206101915 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 file_group ADD owner_id INT NOT NULL');
            $this->addSql('ALTER TABLE file_group ADD CONSTRAINT FK_C743F4F27E3C61F9 FOREIGN KEY (owner_id) REFERENCES owner (id)');
            $this->addSql('CREATE INDEX IDX_C743F4F27E3C61F9 ON file_group (owner_id)');
            $this->addSql('ALTER TABLE file_versions DROP FOREIGN KEY FK_A88CCF4F7E3C61F9');
            $this->addSql('ALTER TABLE file_versions DROP FOREIGN KEY FK_A88CCF4F8BC224C3');
            $this->addSql('DROP INDEX IDX_A88CCF4F8BC224C3 ON file_versions');
            $this->addSql('DROP INDEX IDX_A88CCF4F7E3C61F9 ON file_versions');
            $this->addSql('ALTER TABLE file_versions DROP owner_id, DROP org_unit_id');
        }
    
        public function down(Schema $schema): void
        {
            // this down() migration is auto-generated, please modify it to your needs
            $this->addSql('ALTER TABLE file_group DROP FOREIGN KEY FK_C743F4F27E3C61F9');
            $this->addSql('DROP INDEX IDX_C743F4F27E3C61F9 ON file_group');
            $this->addSql('ALTER TABLE file_group DROP owner_id');
            $this->addSql('ALTER TABLE file_versions ADD owner_id INT NOT NULL, ADD org_unit_id INT DEFAULT NULL');
            $this->addSql('ALTER TABLE file_versions ADD CONSTRAINT FK_A88CCF4F7E3C61F9 FOREIGN KEY (owner_id) REFERENCES owner (id)');
            $this->addSql('ALTER TABLE file_versions ADD CONSTRAINT FK_A88CCF4F8BC224C3 FOREIGN KEY (org_unit_id) REFERENCES org_unit (id)');
            $this->addSql('CREATE INDEX IDX_A88CCF4F8BC224C3 ON file_versions (org_unit_id)');
            $this->addSql('CREATE INDEX IDX_A88CCF4F7E3C61F9 ON file_versions (owner_id)');
        }
    }