<?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 Version20230810123400 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 box DROP FOREIGN KEY FK_8A9483A59E5119C');
$this->addSql('ALTER TABLE operation DROP FOREIGN KEY FK_1981A66D37DC2EE4');
$this->addSql('ALTER TABLE operation DROP FOREIGN KEY FK_1981A66D103AA9F4');
$this->addSql('DROP TABLE slot');
$this->addSql('DROP INDEX UNIQ_8A9483A59E5119C ON box');
$this->addSql('ALTER TABLE box CHANGE slot_id container_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE box ADD CONSTRAINT FK_8A9483ABC21F742 FOREIGN KEY (container_id) REFERENCES container (id)');
$this->addSql('CREATE INDEX IDX_8A9483ABC21F742 ON box (container_id)');
$this->addSql('DROP INDEX IDX_1981A66D37DC2EE4 ON operation');
$this->addSql('DROP INDEX IDX_1981A66D103AA9F4 ON operation');
$this->addSql('ALTER TABLE operation DROP source_slot_id, DROP destination_slot_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$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 = \'\' ');
$this->addSql('ALTER TABLE slot ADD CONSTRAINT FK_AC0E2067BC21F742 FOREIGN KEY (container_id) REFERENCES container (id)');
$this->addSql('ALTER TABLE box DROP FOREIGN KEY FK_8A9483ABC21F742');
$this->addSql('DROP INDEX IDX_8A9483ABC21F742 ON box');
$this->addSql('ALTER TABLE box CHANGE container_id slot_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE box ADD CONSTRAINT FK_8A9483A59E5119C FOREIGN KEY (slot_id) REFERENCES slot (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_8A9483A59E5119C ON box (slot_id)');
$this->addSql('ALTER TABLE operation ADD source_slot_id INT DEFAULT NULL, ADD destination_slot_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE operation ADD CONSTRAINT FK_1981A66D37DC2EE4 FOREIGN KEY (destination_slot_id) REFERENCES slot (id)');
$this->addSql('ALTER TABLE operation ADD CONSTRAINT FK_1981A66D103AA9F4 FOREIGN KEY (source_slot_id) REFERENCES slot (id)');
$this->addSql('CREATE INDEX IDX_1981A66D37DC2EE4 ON operation (destination_slot_id)');
$this->addSql('CREATE INDEX IDX_1981A66D103AA9F4 ON operation (source_slot_id)');
}
}