migrations/Version20220523165638.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 Version20220523165638 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $this->addSql('ALTER TABLE `option` DROP FOREIGN KEY FK_5A8600B03472C456');
  18.         $this->addSql('ALTER TABLE option_category DROP FOREIGN KEY FK_263B68654584665A');
  19.         $this->addSql('DROP TABLE `option`');
  20.         $this->addSql('DROP TABLE option_category');
  21.         $this->addSql('CREATE TABLE `option` (id INT AUTO_INCREMENT NOT NULL, product_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, image VARCHAR(255) DEFAULT NULL, status VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_5A8600B04584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('CREATE TABLE `option_variant` (id INT AUTO_INCREMENT NOT NULL, option_category_id INT NOT NULL, name VARCHAR(255) NOT NULL, price DOUBLE PRECISION NOT NULL, taxe DOUBLE PRECISION DEFAULT NULL, status TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_E9B7A8D83472C456 (option_category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  23.         $this->addSql('ALTER TABLE `option` ADD CONSTRAINT FK_5A8600B04584665A FOREIGN KEY (product_id) REFERENCES product (id)');
  24.         $this->addSql('ALTER TABLE `option_variant` ADD CONSTRAINT FK_E9B7A8D83472C456 FOREIGN KEY (option_category_id) REFERENCES `option` (id)');
  25.         $this->addSql('ALTER TABLE shop_settings CHANGE time_slot_blocking_type time_slot_blocking_type ENUM(\'product\',\'order\')');
  26.     }
  27.     public function down(Schema $schema): void
  28.     {
  29.         $this->addSql('CREATE TABLE `option` (id INT AUTO_INCREMENT NOT NULL, option_category_id INT NOT NULL, name VARCHAR(255) NOT NULL, price DOUBLE PRECISION NOT NULL, taxe DOUBLE PRECISION DEFAULT NULL, status TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_5A8600B03472C456 (option_category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  30.         $this->addSql('CREATE TABLE option_category (id INT AUTO_INCREMENT NOT NULL, product_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, image VARCHAR(255) DEFAULT NULL, status VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_263B68654584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  31.         $this->addSql('ALTER TABLE `option` ADD CONSTRAINT FK_5A8600B03472C456 FOREIGN KEY (option_category_id) REFERENCES option_category (id)');
  32.         $this->addSql('ALTER TABLE option_category ADD CONSTRAINT FK_263B68654584665A FOREIGN KEY (product_id) REFERENCES product (id)');
  33.         
  34.         // this down() migration is auto-generated, please modify it to your needs
  35.         $this->addSql('ALTER TABLE `option_variant` DROP FOREIGN KEY FK_E9B7A8D83472C456');
  36.         $this->addSql('DROP TABLE `option`');
  37.         $this->addSql('DROP TABLE `option_variant`');
  38.         $this->addSql('ALTER TABLE shop_settings CHANGE time_slot_blocking_type time_slot_blocking_type VARCHAR(255) DEFAULT NULL');
  39.     }
  40. }