<?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 Version20230614154621 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('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');
$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');
$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');
$this->addSql('ALTER TABLE champs_affaire ADD CONSTRAINT FK_EF727D2D84FC98A0 FOREIGN KEY (apporteur_id) REFERENCES apporteur_affaire (id)');
$this->addSql('ALTER TABLE deal ADD apporteur_affaire_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE deal ADD CONSTRAINT FK_E3FEC116A0BBFBF FOREIGN KEY (apporteur_affaire_id) REFERENCES apporteur_affaire (id)');
$this->addSql('CREATE INDEX IDX_E3FEC116A0BBFBF ON deal (apporteur_affaire_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE champs_affaire DROP FOREIGN KEY FK_EF727D2D84FC98A0');
$this->addSql('ALTER TABLE deal DROP FOREIGN KEY FK_E3FEC116A0BBFBF');
$this->addSql('DROP TABLE apporteur_affaire');
$this->addSql('DROP TABLE champs_affaire');
$this->addSql('DROP TABLE champs_deauf_affaire');
$this->addSql('DROP INDEX IDX_E3FEC116A0BBFBF ON deal');
$this->addSql('ALTER TABLE deal DROP apporteur_affaire_id');
}
}