migrations/Version20220601110403.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 Version20220601110403 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 article (id INT AUTO_INCREMENT NOT NULL, type_id INT DEFAULT NULL, titre VARCHAR(100) NOT NULL, sous_titre VARCHAR(100) DEFAULT NULL, actif TINYINT(1) DEFAULT NULL, description LONGTEXT DEFAULT NULL, keywords LONGTEXT DEFAULT NULL, image VARCHAR(255) DEFAULT NULL, meta_description LONGTEXT DEFAULT NULL, id_import VARCHAR(255) DEFAULT NULL, id_import_liee VARCHAR(255) DEFAULT NULL, ordre BIGINT DEFAULT NULL, INDEX IDX_23A0E66C54C8C93 (type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE article_contenu (id INT AUTO_INCREMENT NOT NULL, article_id INT NOT NULL, titre VARCHAR(100) DEFAULT NULL, paragraphe LONGTEXT DEFAULT NULL, ordre BIGINT DEFAULT NULL, image VARCHAR(255) DEFAULT NULL, position VARCHAR(100) DEFAULT NULL, id_import_liee VARCHAR(255) DEFAULT NULL, date_creation DATETIME DEFAULT NULL, date_modification DATETIME DEFAULT NULL, INDEX IDX_641044887294869C (article_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE article_type (id INT AUTO_INCREMENT NOT NULL, type VARCHAR(100) NOT NULL, ordre BIGINT DEFAULT NULL, nbr_liaison INT DEFAULT NULL, date_creation DATETIME DEFAULT NULL, date_modification DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('ALTER TABLE article ADD CONSTRAINT FK_23A0E66C54C8C93 FOREIGN KEY (type_id) REFERENCES article_type (id)');
  22.         $this->addSql('ALTER TABLE article_contenu ADD CONSTRAINT FK_641044887294869C FOREIGN KEY (article_id) REFERENCES article (id)');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('ALTER TABLE article_contenu DROP FOREIGN KEY FK_641044887294869C');
  28.         $this->addSql('ALTER TABLE article DROP FOREIGN KEY FK_23A0E66C54C8C93');
  29.         $this->addSql('DROP TABLE article');
  30.         $this->addSql('DROP TABLE article_contenu');
  31.         $this->addSql('DROP TABLE article_type');
  32.     }
  33. }