<?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 Version20220809154520 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 api_documents DROP FOREIGN KEY FK_DF64D7F354963938');
$this->addSql('DROP INDEX fk_document_api_id ON api_documents');
$this->addSql('ALTER TABLE api_documents DROP version, CHANGE api_id api_version_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE api_documents ADD CONSTRAINT FK_DF64D7F38C165B14 FOREIGN KEY (api_version_id) REFERENCES api_version (id)');
$this->addSql('CREATE INDEX IDX_DF64D7F38C165B14 ON api_documents (api_version_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE api_documents DROP FOREIGN KEY FK_DF64D7F38C165B14');
$this->addSql('DROP INDEX IDX_DF64D7F38C165B14 ON api_documents');
$this->addSql('ALTER TABLE api_documents ADD version VARCHAR(50) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE api_version_id api_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE api_documents ADD CONSTRAINT FK_DF64D7F354963938 FOREIGN KEY (api_id) REFERENCES apis (id)');
$this->addSql('CREATE INDEX fk_document_api_id ON api_documents (api_id)');
}
}