46 lines
2.1 KiB
PHP
46 lines
2.1 KiB
PHP
<?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 Version20231012164550 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 disposition DROP FOREIGN KEY FK_4C58BF60EA295441');
|
|
$this->addSql('ALTER TABLE disposition DROP FOREIGN KEY FK_4C58BF606D5F2C5F');
|
|
$this->addSql('DROP INDEX UNIQ_4C58BF606D5F2C5F ON disposition');
|
|
$this->addSql('DROP INDEX UNIQ_4C58BF60EA295441 ON disposition');
|
|
$this->addSql('ALTER TABLE disposition DROP contract_pdf_id, DROP invoice_pdf_id');
|
|
$this->addSql('ALTER TABLE upload ADD disposition_id INT DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE upload ADD CONSTRAINT FK_17BDE61F287B65ED FOREIGN KEY (disposition_id) REFERENCES disposition (id)');
|
|
$this->addSql('CREATE INDEX IDX_17BDE61F287B65ED ON upload (disposition_id)');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
// this down() migration is auto-generated, please modify it to your needs
|
|
$this->addSql('ALTER TABLE disposition ADD contract_pdf_id INT DEFAULT NULL, ADD invoice_pdf_id INT DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE disposition ADD CONSTRAINT FK_4C58BF60EA295441 FOREIGN KEY (invoice_pdf_id) REFERENCES upload (id)');
|
|
$this->addSql('ALTER TABLE disposition ADD CONSTRAINT FK_4C58BF606D5F2C5F FOREIGN KEY (contract_pdf_id) REFERENCES upload (id)');
|
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_4C58BF606D5F2C5F ON disposition (contract_pdf_id)');
|
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_4C58BF60EA295441 ON disposition (invoice_pdf_id)');
|
|
$this->addSql('ALTER TABLE upload DROP FOREIGN KEY FK_17BDE61F287B65ED');
|
|
$this->addSql('DROP INDEX IDX_17BDE61F287B65ED ON upload');
|
|
$this->addSql('ALTER TABLE upload DROP disposition_id');
|
|
}
|
|
}
|