<?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 Version20220805143053 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('CREATE TABLE endpoind_version_models (id INT AUTO_INCREMENT NOT NULL, api_version_id INT DEFAULT NULL, model_id INT DEFAULT NULL, endpoind_id INT DEFAULT NULL, INDEX IDX_AEAA74688C165B14 (api_version_id), INDEX IDX_AEAA74687975B7E7 (model_id), INDEX IDX_AEAA746871B629A9 (endpoind_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE endpoind_version_models ADD CONSTRAINT FK_AEAA74688C165B14 FOREIGN KEY (api_version_id) REFERENCES api_version (id)');
$this->addSql('ALTER TABLE endpoind_version_models ADD CONSTRAINT FK_AEAA74687975B7E7 FOREIGN KEY (model_id) REFERENCES models (id)');
$this->addSql('ALTER TABLE endpoind_version_models ADD CONSTRAINT FK_AEAA746871B629A9 FOREIGN KEY (endpoind_id) REFERENCES endpoinds (id)');
$this->addSql('ALTER TABLE api_version ADD slug VARCHAR(50) DEFAULT NULL');
$this->addSql('ALTER TABLE endpoind_aggregation DROP FOREIGN KEY FK_CF76235271B629A9');
$this->addSql('DROP INDEX IDX_CF76235271B629A9 ON endpoind_aggregation');
$this->addSql('ALTER TABLE endpoind_aggregation CHANGE endpoind_id endpoind_version_model_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE endpoind_aggregation ADD CONSTRAINT FK_CF762352742222F4 FOREIGN KEY (endpoind_version_model_id) REFERENCES endpoind_version_models (id)');
$this->addSql('CREATE INDEX IDX_CF762352742222F4 ON endpoind_aggregation (endpoind_version_model_id)');
$this->addSql('ALTER TABLE endpoinds DROP FOREIGN KEY FK_96DF37E17975B7E7');
$this->addSql('DROP INDEX IDX_96DF37E17975B7E7 ON endpoinds');
$this->addSql('ALTER TABLE endpoinds DROP model_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE endpoind_aggregation DROP FOREIGN KEY FK_CF762352742222F4');
$this->addSql('DROP TABLE endpoind_version_models');
$this->addSql('ALTER TABLE api_version DROP slug');
$this->addSql('DROP INDEX IDX_CF762352742222F4 ON endpoind_aggregation');
$this->addSql('ALTER TABLE endpoind_aggregation CHANGE endpoind_version_model_id endpoind_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE endpoind_aggregation ADD CONSTRAINT FK_CF76235271B629A9 FOREIGN KEY (endpoind_id) REFERENCES endpoinds (id)');
$this->addSql('CREATE INDEX IDX_CF76235271B629A9 ON endpoind_aggregation (endpoind_id)');
$this->addSql('ALTER TABLE endpoinds ADD model_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE endpoinds ADD CONSTRAINT FK_96DF37E17975B7E7 FOREIGN KEY (model_id) REFERENCES models (id)');
$this->addSql('CREATE INDEX IDX_96DF37E17975B7E7 ON endpoinds (model_id)');
}
}