migrations/Version20211010071935.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 Version20211010071935 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 price_list (id INT AUTO_INCREMENT NOT NULL, price_map_id INT DEFAULT NULL, grams INT DEFAULT NULL, height INT NOT NULL, width INT NOT NULL, depth INT NOT NULL, min_quantity INT NOT NULL, max_quantity INT NOT NULL, price_per_unit NUMERIC(12, 4) NOT NULL, units VARCHAR(255) DEFAULT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', UNIQUE INDEX UNIQ_399A0AA2D17F50A6 (uuid), INDEX IDX_399A0AA21E5CF734 (price_map_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE price_map (id INT AUTO_INCREMENT NOT NULL, manufacturer_id INT DEFAULT NULL, code VARCHAR(255) NOT NULL, packaging_types LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', pouch_types LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', segments LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', structures LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', varnishes LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', pouch_options LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', sustainable TINYINT(1) NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', UNIQUE INDEX UNIQ_C6C1A134D17F50A6 (uuid), INDEX IDX_C6C1A134A23B42D (manufacturer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE price_list ADD CONSTRAINT FK_399A0AA21E5CF734 FOREIGN KEY (price_map_id) REFERENCES price_map (id)');
  21.         $this->addSql('ALTER TABLE price_map ADD CONSTRAINT FK_C6C1A134A23B42D FOREIGN KEY (manufacturer_id) REFERENCES manufacturer (id)');
  22.     }
  23.     public function down(Schema $schema): void
  24.     {
  25.         // this down() migration is auto-generated, please modify it to your needs
  26.         $this->addSql('ALTER TABLE price_list DROP FOREIGN KEY FK_399A0AA21E5CF734');
  27.         $this->addSql('DROP TABLE price_list');
  28.         $this->addSql('DROP TABLE price_map');
  29.     }
  30. }