<?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 Version20220517094016 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE product_shop_mode (id INT AUTO_INCREMENT NOT NULL, product_id INT DEFAULT NULL, shop_mode_id INT DEFAULT NULL, tax_id INT DEFAULT NULL, price DOUBLE PRECISION DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_3898175D4584665A (product_id), INDEX IDX_3898175D74D6C560 (shop_mode_id), INDEX IDX_3898175DB2A824D8 (tax_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE product_shop_mode ADD CONSTRAINT FK_3898175D4584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('ALTER TABLE product_shop_mode ADD CONSTRAINT FK_3898175D74D6C560 FOREIGN KEY (shop_mode_id) REFERENCES shop_mode (id)');
$this->addSql('ALTER TABLE product_shop_mode ADD CONSTRAINT FK_3898175DB2A824D8 FOREIGN KEY (tax_id) REFERENCES tax (id)');
$this->addSql('ALTER TABLE product DROP price, DROP taxe');
$this->addSql('ALTER TABLE shop ADD currency_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE shop ADD CONSTRAINT FK_AC6A4CA238248176 FOREIGN KEY (currency_id) REFERENCES currency (id)');
$this->addSql('CREATE INDEX IDX_AC6A4CA238248176 ON shop (currency_id)');
$this->addSql('ALTER TABLE shop_settings CHANGE time_slot_blocking_type time_slot_blocking_type ENUM(\'product\',\'order\')');
$this->addSql('ALTER TABLE tax ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL, DROP create_at, DROP edited_at, CHANGE value value INT DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE product_shop_mode');
$this->addSql('ALTER TABLE product ADD price DOUBLE PRECISION NOT NULL, ADD taxe DOUBLE PRECISION DEFAULT NULL');
$this->addSql('ALTER TABLE shop DROP FOREIGN KEY FK_AC6A4CA238248176');
$this->addSql('DROP INDEX IDX_AC6A4CA238248176 ON shop');
$this->addSql('ALTER TABLE shop DROP currency_id');
$this->addSql('ALTER TABLE shop_settings CHANGE time_slot_blocking_type time_slot_blocking_type VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE tax ADD create_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD edited_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', DROP created_at, DROP updated_at, CHANGE value value DOUBLE PRECISION NOT NULL');
}
}