migrations/Version20230614154621.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 Version20230614154621 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 apporteur_affaire (id INT AUTO_INCREMENT NOT NULL, nom VARCHAR(255) DEFAULT NULL, prenom VARCHAR(255) DEFAULT NULL, societe VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, phone VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE champs_affaire (id INT AUTO_INCREMENT NOT NULL, apporteur_id INT DEFAULT NULL, nom VARCHAR(255) DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, date DATETIME NOT NULL, status VARCHAR(255) DEFAULT NULL, valeur VARCHAR(255) DEFAULT NULL, INDEX IDX_EF727D2D84FC98A0 (apporteur_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE champs_deauf_affaire (id INT AUTO_INCREMENT NOT NULL, nom VARCHAR(255) DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('ALTER TABLE champs_affaire ADD CONSTRAINT FK_EF727D2D84FC98A0 FOREIGN KEY (apporteur_id) REFERENCES apporteur_affaire (id)');
  22.         $this->addSql('ALTER TABLE deal ADD apporteur_affaire_id INT DEFAULT NULL');
  23.         $this->addSql('ALTER TABLE deal ADD CONSTRAINT FK_E3FEC116A0BBFBF FOREIGN KEY (apporteur_affaire_id) REFERENCES apporteur_affaire (id)');
  24.         $this->addSql('CREATE INDEX IDX_E3FEC116A0BBFBF ON deal (apporteur_affaire_id)');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('ALTER TABLE champs_affaire DROP FOREIGN KEY FK_EF727D2D84FC98A0');
  30.         $this->addSql('ALTER TABLE deal DROP FOREIGN KEY FK_E3FEC116A0BBFBF');
  31.         $this->addSql('DROP TABLE apporteur_affaire');
  32.         $this->addSql('DROP TABLE champs_affaire');
  33.         $this->addSql('DROP TABLE champs_deauf_affaire');
  34.         $this->addSql('DROP INDEX IDX_E3FEC116A0BBFBF ON deal');
  35.         $this->addSql('ALTER TABLE deal DROP apporteur_affaire_id');
  36.     }
  37. }