migrations/Version20230509114759.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 Version20230509114759 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('CREATE TABLE contrat (id INT AUTO_INCREMENT NOT NULL, numero VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, date DATE NOT NULL, status VARCHAR(255) NOT NULL, commentaire LONGTEXT NOT NULL, file VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE contrat_signe (id INT AUTO_INCREMENT NOT NULL, contrat_id INT DEFAULT NULL, installateur_id INT DEFAULT NULL, date DATE NOT NULL, status VARCHAR(255) NOT NULL, file VARCHAR(255) NOT NULL, commentaire LONGTEXT NOT NULL, INDEX IDX_4F02B2161823061F (contrat_id), INDEX IDX_4F02B21651262FCB (installateur_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE contrat_signe ADD CONSTRAINT FK_4F02B2161823061F FOREIGN KEY (contrat_id) REFERENCES contrat (id)');
  21.         $this->addSql('ALTER TABLE contrat_signe ADD CONSTRAINT FK_4F02B21651262FCB FOREIGN KEY (installateur_id) REFERENCES installateur (id)');
  22.         $this->addSql('ALTER TABLE deal ADD contrat_id INT DEFAULT NULL');
  23.         $this->addSql('ALTER TABLE deal ADD CONSTRAINT FK_E3FEC1161823061F FOREIGN KEY (contrat_id) REFERENCES contrat (id)');
  24.         $this->addSql('CREATE INDEX IDX_E3FEC1161823061F ON deal (contrat_id)');
  25.         $this->addSql('ALTER TABLE equipe CHANGE permissions permissions JSON NOT NULL');
  26.     }
  27.     public function down(Schema $schema): void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->addSql('ALTER TABLE contrat_signe DROP FOREIGN KEY FK_4F02B2161823061F');
  31.         $this->addSql('ALTER TABLE deal DROP FOREIGN KEY FK_E3FEC1161823061F');
  32.         $this->addSql('DROP TABLE contrat');
  33.         $this->addSql('DROP TABLE contrat_signe');
  34.         $this->addSql('DROP INDEX IDX_E3FEC1161823061F ON deal');
  35.         $this->addSql('ALTER TABLE deal DROP contrat_id');
  36.         $this->addSql('ALTER TABLE equipe CHANGE permissions permissions LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:array)\'');
  37.     }
  38. }