migrations/Version20220405105721.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20220405105721 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Crée la table upload et les champs offer, dpgf et negotiationReport dans la table tenderer.';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $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');
  18.         $this->addSql('ALTER TABLE tenderer ADD offer_id INT DEFAULT NULL, ADD dpgf_id INT DEFAULT NULL, ADD negotiation_report_id INT DEFAULT NULL');
  19.         $this->addSql('ALTER TABLE tenderer ADD CONSTRAINT FK_37F6A81B53C674EE FOREIGN KEY (offer_id) REFERENCES upload (id)');
  20.         $this->addSql('ALTER TABLE tenderer ADD CONSTRAINT FK_37F6A81B45E8A5E9 FOREIGN KEY (dpgf_id) REFERENCES upload (id)');
  21.         $this->addSql('ALTER TABLE tenderer ADD CONSTRAINT FK_37F6A81BA2CC7B5 FOREIGN KEY (negotiation_report_id) REFERENCES upload (id)');
  22.     }
  23.     public function down(Schema $schema): void
  24.     {
  25.         $this->addSql('ALTER TABLE tenderer DROP FOREIGN KEY FK_37F6A81BA2CC7B5');
  26.         $this->addSql('ALTER TABLE tenderer DROP FOREIGN KEY FK_37F6A81B45E8A5E9');
  27.         $this->addSql('ALTER TABLE tenderer DROP FOREIGN KEY FK_37F6A81B53C674EE');
  28.         $this->addSql('ALTER TABLE tenderer DROP offer_id, DROP dpgf_id, DROP negotiation_report_id');
  29.         $this->addSql('DROP TABLE upload');
  30.     }
  31. }