migrations/Version20220330114845.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 Version20220330114845 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'création des livrets d\'apprentissage';
  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 livret (id INT AUTO_INCREMENT NOT NULL, intitule VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE livret_shop_categorie (livret_id INT NOT NULL, shop_categorie_id INT NOT NULL, INDEX IDX_3C4CAAA376274781 (livret_id), INDEX IDX_3C4CAAA3A19080BF (shop_categorie_id), PRIMARY KEY(livret_id, shop_categorie_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE livret_acquis (id INT AUTO_INCREMENT NOT NULL, competence_id INT NOT NULL, intitule VARCHAR(255) NOT NULL, INDEX IDX_7D3A72C515761DAB (competence_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('CREATE TABLE livret_competence (id INT AUTO_INCREMENT NOT NULL, livret_id INT NOT NULL, intitule VARCHAR(255) NOT NULL, INDEX IDX_4C07CE2076274781 (livret_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('ALTER TABLE livret_shop_categorie ADD CONSTRAINT FK_3C4CAAA376274781 FOREIGN KEY (livret_id) REFERENCES livret (id) ON DELETE CASCADE');
  23.         $this->addSql('ALTER TABLE livret_shop_categorie ADD CONSTRAINT FK_3C4CAAA3A19080BF FOREIGN KEY (shop_categorie_id) REFERENCES shop_categorie (id) ON DELETE CASCADE');
  24.         $this->addSql('ALTER TABLE livret_acquis ADD CONSTRAINT FK_7D3A72C515761DAB FOREIGN KEY (competence_id) REFERENCES livret_competence (id)');
  25.         $this->addSql('ALTER TABLE livret_competence ADD CONSTRAINT FK_4C07CE2076274781 FOREIGN KEY (livret_id) REFERENCES livret (id)');
  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 livret_shop_categorie DROP FOREIGN KEY FK_3C4CAAA376274781');
  31.         $this->addSql('ALTER TABLE livret_competence DROP FOREIGN KEY FK_4C07CE2076274781');
  32.         $this->addSql('ALTER TABLE livret_acquis DROP FOREIGN KEY FK_7D3A72C515761DAB');
  33.         $this->addSql('DROP TABLE livret');
  34.         $this->addSql('DROP TABLE livret_shop_categorie');
  35.         $this->addSql('DROP TABLE livret_acquis');
  36.         $this->addSql('DROP TABLE livret_competence');
  37.     }
  38. }