migrations/Version20230810123400.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 Version20230810123400 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 box DROP FOREIGN KEY FK_8A9483A59E5119C');
  19.         $this->addSql('ALTER TABLE operation DROP FOREIGN KEY FK_1981A66D37DC2EE4');
  20.         $this->addSql('ALTER TABLE operation DROP FOREIGN KEY FK_1981A66D103AA9F4');
  21.         $this->addSql('DROP TABLE slot');
  22.         $this->addSql('DROP INDEX UNIQ_8A9483A59E5119C ON box');
  23.         $this->addSql('ALTER TABLE box CHANGE slot_id container_id INT DEFAULT NULL');
  24.         $this->addSql('ALTER TABLE box ADD CONSTRAINT FK_8A9483ABC21F742 FOREIGN KEY (container_id) REFERENCES container (id)');
  25.         $this->addSql('CREATE INDEX IDX_8A9483ABC21F742 ON box (container_id)');
  26.         $this->addSql('DROP INDEX IDX_1981A66D37DC2EE4 ON operation');
  27.         $this->addSql('DROP INDEX IDX_1981A66D103AA9F4 ON operation');
  28.         $this->addSql('ALTER TABLE operation DROP source_slot_id, DROP destination_slot_id');
  29.     }
  30.     public function down(Schema $schema): void
  31.     {
  32.         // this down() migration is auto-generated, please modify it to your needs
  33.         $this->addSql('CREATE TABLE slot (id INT AUTO_INCREMENT NOT NULL, container_id INT NOT NULL, ident VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, type VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, seq_no INT NOT NULL, INDEX IDX_AC0E2067BC21F742 (container_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  34.         $this->addSql('ALTER TABLE slot ADD CONSTRAINT FK_AC0E2067BC21F742 FOREIGN KEY (container_id) REFERENCES container (id)');
  35.         $this->addSql('ALTER TABLE box DROP FOREIGN KEY FK_8A9483ABC21F742');
  36.         $this->addSql('DROP INDEX IDX_8A9483ABC21F742 ON box');
  37.         $this->addSql('ALTER TABLE box CHANGE container_id slot_id INT DEFAULT NULL');
  38.         $this->addSql('ALTER TABLE box ADD CONSTRAINT FK_8A9483A59E5119C FOREIGN KEY (slot_id) REFERENCES slot (id)');
  39.         $this->addSql('CREATE UNIQUE INDEX UNIQ_8A9483A59E5119C ON box (slot_id)');
  40.         $this->addSql('ALTER TABLE operation ADD source_slot_id INT DEFAULT NULL, ADD destination_slot_id INT DEFAULT NULL');
  41.         $this->addSql('ALTER TABLE operation ADD CONSTRAINT FK_1981A66D37DC2EE4 FOREIGN KEY (destination_slot_id) REFERENCES slot (id)');
  42.         $this->addSql('ALTER TABLE operation ADD CONSTRAINT FK_1981A66D103AA9F4 FOREIGN KEY (source_slot_id) REFERENCES slot (id)');
  43.         $this->addSql('CREATE INDEX IDX_1981A66D37DC2EE4 ON operation (destination_slot_id)');
  44.         $this->addSql('CREATE INDEX IDX_1981A66D103AA9F4 ON operation (source_slot_id)');
  45.     }
  46. }