<?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 Version20220405105721 extends AbstractMigration
{
public function getDescription(): string
{
return 'Crée la table upload et les champs offer, dpgf et negotiationReport dans la table tenderer.';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE upload (id INT AUTO_INCREMENT NOT NULL, type VARCHAR(255) NOT NULL, path VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, mime_type VARCHAR(255) NOT NULL, size INT NOT NULL, user VARCHAR(255) NOT NULL, date DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE `UTF8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE tenderer ADD offer_id INT DEFAULT NULL, ADD dpgf_id INT DEFAULT NULL, ADD negotiation_report_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE tenderer ADD CONSTRAINT FK_37F6A81B53C674EE FOREIGN KEY (offer_id) REFERENCES upload (id)');
$this->addSql('ALTER TABLE tenderer ADD CONSTRAINT FK_37F6A81B45E8A5E9 FOREIGN KEY (dpgf_id) REFERENCES upload (id)');
$this->addSql('ALTER TABLE tenderer ADD CONSTRAINT FK_37F6A81BA2CC7B5 FOREIGN KEY (negotiation_report_id) REFERENCES upload (id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE tenderer DROP FOREIGN KEY FK_37F6A81BA2CC7B5');
$this->addSql('ALTER TABLE tenderer DROP FOREIGN KEY FK_37F6A81B45E8A5E9');
$this->addSql('ALTER TABLE tenderer DROP FOREIGN KEY FK_37F6A81B53C674EE');
$this->addSql('ALTER TABLE tenderer DROP offer_id, DROP dpgf_id, DROP negotiation_report_id');
$this->addSql('DROP TABLE upload');
}
}