<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220523165638 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE `option` DROP FOREIGN KEY FK_5A8600B03472C456');
$this->addSql('ALTER TABLE option_category DROP FOREIGN KEY FK_263B68654584665A');
$this->addSql('DROP TABLE `option`');
$this->addSql('DROP TABLE option_category');
$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');
$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');
$this->addSql('ALTER TABLE `option` ADD CONSTRAINT FK_5A8600B04584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('ALTER TABLE `option_variant` ADD CONSTRAINT FK_E9B7A8D83472C456 FOREIGN KEY (option_category_id) REFERENCES `option` (id)');
$this->addSql('ALTER TABLE shop_settings CHANGE time_slot_blocking_type time_slot_blocking_type ENUM(\'product\',\'order\')');
}
public function down(Schema $schema): void
{
$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');
$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');
$this->addSql('ALTER TABLE `option` ADD CONSTRAINT FK_5A8600B03472C456 FOREIGN KEY (option_category_id) REFERENCES option_category (id)');
$this->addSql('ALTER TABLE option_category ADD CONSTRAINT FK_263B68654584665A FOREIGN KEY (product_id) REFERENCES product (id)');
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE `option_variant` DROP FOREIGN KEY FK_E9B7A8D83472C456');
$this->addSql('DROP TABLE `option`');
$this->addSql('DROP TABLE `option_variant`');
$this->addSql('ALTER TABLE shop_settings CHANGE time_slot_blocking_type time_slot_blocking_type VARCHAR(255) DEFAULT NULL');
}
}