migrations/Version20240604211445.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 Version20240604211445 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 ref_liasse (id INT AUTO_INCREMENT NOT NULL, code_liasse VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE lnk_liasse_variables (liasse_id INT NOT NULL, variable_id INT NOT NULL, INDEX IDX_72D60161180764BC (liasse_id), INDEX IDX_72D60161F3037E8E (variable_id), PRIMARY KEY(liasse_id, variable_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE ref_variable (id INT AUTO_INCREMENT NOT NULL, libelle VARCHAR(255) DEFAULT NULL, model_entity VARCHAR(255) NOT NULL, champ_variable VARCHAR(255) NOT NULL, foreing_key VARCHAR(255) DEFAULT NULL, variable_editique VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('ALTER TABLE lnk_liasse_variables ADD CONSTRAINT FK_72D60161180764BC FOREIGN KEY (liasse_id) REFERENCES ref_liasse (id)');
  22.         $this->addSql('ALTER TABLE lnk_liasse_variables ADD CONSTRAINT FK_72D60161F3037E8E FOREIGN KEY (variable_id) REFERENCES ref_variable (id)');
  23.         
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('ALTER TABLE lnk_liasse_variables DROP FOREIGN KEY FK_72D60161180764BC');
  29.         $this->addSql('ALTER TABLE lnk_liasse_variables DROP FOREIGN KEY FK_72D60161F3037E8E');
  30.         $this->addSql('DROP TABLE ref_liasse');
  31.         $this->addSql('DROP TABLE lnk_liasse_variables');
  32.         $this->addSql('DROP TABLE ref_variable');
  33.         
  34.     }
  35. }