migrations/Version20220610203614.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 Version20220610203614 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('ALTER TABLE ingredient ADD unit_id INT DEFAULT NULL, ADD show_unit TINYINT(1) DEFAULT NULL, ADD weight NUMERIC(10, 4) DEFAULT NULL, ADD kcal INT DEFAULT NULL, ADD gluten_free TINYINT(1) DEFAULT NULL, ADD vegetarian TINYINT(1) DEFAULT NULL, ADD vegan TINYINT(1) DEFAULT NULL, ADD lacto_free TINYINT(1) DEFAULT NULL, ADD protein INT DEFAULT NULL, ADD fats INT DEFAULT NULL, ADD carbohydrates INT DEFAULT NULL, ADD fiber INT DEFAULT NULL, ADD salt INT DEFAULT NULL, ADD unsaturated_fatty_acids INT DEFAULT NULL, ADD simple_sugars INT DEFAULT NULL, ADD glycemic_index INT DEFAULT NULL');
  19.         $this->addSql('ALTER TABLE ingredient ADD CONSTRAINT FK_6BAF7870F8BD700D FOREIGN KEY (unit_id) REFERENCES unit (id)');
  20.         $this->addSql('CREATE INDEX IDX_6BAF7870F8BD700D ON ingredient (unit_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 ingredient DROP FOREIGN KEY FK_6BAF7870F8BD700D');
  26.         $this->addSql('DROP INDEX IDX_6BAF7870F8BD700D ON ingredient');
  27.         $this->addSql('ALTER TABLE ingredient DROP unit_id, DROP show_unit, DROP weight, DROP kcal, DROP gluten_free, DROP vegetarian, DROP vegan, DROP lacto_free, DROP protein, DROP fats, DROP carbohydrates, DROP fiber, DROP salt, DROP unsaturated_fatty_acids, DROP simple_sugars, DROP glycemic_index');
  28.     }
  29. }