migrations/Version20210719092844.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 Version20210719092844 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 shop_categorie (id INT AUTO_INCREMENT NOT NULL, intitule VARCHAR(255) NOT NULL, descriptif VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE shop_produit (id INT AUTO_INCREMENT NOT NULL, categorie_id INT DEFAULT NULL, intitule VARCHAR(255) NOT NULL, descriptif VARCHAR(255) NOT NULL, INDEX IDX_2A96AC0DBCF5E72D (categorie_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE shop_produit ADD CONSTRAINT FK_2A96AC0DBCF5E72D FOREIGN KEY (categorie_id) REFERENCES shop_categorie (id)');
  21.     }
  22.     public function down(Schema $schema): void
  23.     {
  24.         // this down() migration is auto-generated, please modify it to your needs
  25.         $this->addSql('ALTER TABLE shop_produit DROP FOREIGN KEY FK_2A96AC0DBCF5E72D');
  26.         $this->addSql('DROP TABLE shop_categorie');
  27.         $this->addSql('DROP TABLE shop_produit');
  28.     }
  29. }