<?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 Version20211202145223 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 author_file_versions (author_id INT NOT NULL, file_versions_id INT NOT NULL, INDEX IDX_9BD150A2F675F31B (author_id), INDEX IDX_9BD150A2B5EB0BEF (file_versions_id), PRIMARY KEY(author_id, file_versions_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE author_file_versions ADD CONSTRAINT FK_9BD150A2F675F31B FOREIGN KEY (author_id) REFERENCES author (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE author_file_versions ADD CONSTRAINT FK_9BD150A2B5EB0BEF FOREIGN KEY (file_versions_id) REFERENCES file_versions (id) ON DELETE CASCADE');
$this->addSql('DROP TABLE author_file');
$this->addSql('ALTER TABLE file DROP FOREIGN KEY FK_8C9F36104F0456DA');
$this->addSql('ALTER TABLE file DROP FOREIGN KEY FK_8C9F36107E3C61F9');
$this->addSql('ALTER TABLE file DROP FOREIGN KEY FK_8C9F36108BC224C3');
$this->addSql('DROP INDEX IDX_8C9F36104F0456DA ON file');
$this->addSql('DROP INDEX IDX_8C9F36107E3C61F9 ON file');
$this->addSql('DROP INDEX IDX_8C9F36108BC224C3 ON file');
$this->addSql('ALTER TABLE file DROP file_group_id, DROP owner_id, DROP org_unit_id, DROP nomefile');
$this->addSql('ALTER TABLE file_versions ADD file_group_id INT NOT NULL, ADD owner_id INT NOT NULL, ADD org_unit_id INT DEFAULT NULL, ADD nomefile VARCHAR(255) NOT NULL, ADD sql_idc INT NOT NULL, ADD disabled TINYINT(1) DEFAULT NULL');
$this->addSql('ALTER TABLE file_versions ADD CONSTRAINT FK_A88CCF4F4F0456DA FOREIGN KEY (file_group_id) REFERENCES file_group (id)');
$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_A88CCF4F4F0456DA ON file_versions (file_group_id)');
$this->addSql('CREATE INDEX IDX_A88CCF4F7E3C61F9 ON file_versions (owner_id)');
$this->addSql('CREATE INDEX IDX_A88CCF4F8BC224C3 ON file_versions (org_unit_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE author_file (author_id INT NOT NULL, file_id INT NOT NULL, INDEX IDX_6870BECF93CB796C (file_id), INDEX IDX_6870BECFF675F31B (author_id), PRIMARY KEY(author_id, file_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE author_file ADD CONSTRAINT FK_6870BECF93CB796C FOREIGN KEY (file_id) REFERENCES file (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE author_file ADD CONSTRAINT FK_6870BECFF675F31B FOREIGN KEY (author_id) REFERENCES author (id) ON DELETE CASCADE');
$this->addSql('DROP TABLE author_file_versions');
$this->addSql('ALTER TABLE file ADD file_group_id INT NOT NULL, ADD owner_id INT NOT NULL, ADD org_unit_id INT DEFAULT NULL, ADD nomefile VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`');
$this->addSql('ALTER TABLE file ADD CONSTRAINT FK_8C9F36104F0456DA FOREIGN KEY (file_group_id) REFERENCES file_group (id)');
$this->addSql('ALTER TABLE file ADD CONSTRAINT FK_8C9F36107E3C61F9 FOREIGN KEY (owner_id) REFERENCES owner (id)');
$this->addSql('ALTER TABLE file ADD CONSTRAINT FK_8C9F36108BC224C3 FOREIGN KEY (org_unit_id) REFERENCES org_unit (id)');
$this->addSql('CREATE INDEX IDX_8C9F36104F0456DA ON file (file_group_id)');
$this->addSql('CREATE INDEX IDX_8C9F36107E3C61F9 ON file (owner_id)');
$this->addSql('CREATE INDEX IDX_8C9F36108BC224C3 ON file (org_unit_id)');
$this->addSql('ALTER TABLE file_versions DROP FOREIGN KEY FK_A88CCF4F4F0456DA');
$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_A88CCF4F4F0456DA ON file_versions');
$this->addSql('DROP INDEX IDX_A88CCF4F7E3C61F9 ON file_versions');
$this->addSql('DROP INDEX IDX_A88CCF4F8BC224C3 ON file_versions');
$this->addSql('ALTER TABLE file_versions DROP file_group_id, DROP owner_id, DROP org_unit_id, DROP nomefile, DROP sql_idc, DROP disabled');
}
}