<?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 Version20230323115049 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('ALTER TABLE discount DROP FOREIGN KEY FK_E1E0B40E4D16C4DD');
$this->addSql('ALTER TABLE discount_mode DROP FOREIGN KEY FK_94842114C7C611F');
$this->addSql('ALTER TABLE discount_mode DROP FOREIGN KEY FK_948421177E5854A');
$this->addSql('DROP TABLE discount');
$this->addSql('DROP TABLE discount_mode');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE discount (id INT AUTO_INCREMENT NOT NULL, shop_id INT DEFAULT NULL, code VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, description VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, start_time DATETIME NOT NULL, end_time DATETIME NOT NULL, type VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, value DOUBLE PRECISION DEFAULT NULL, delivery_fee VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, first_order_only TINYINT(1) DEFAULT NULL, applicapble_once TINYINT(1) DEFAULT NULL, minimum_amount TINYINT(1) DEFAULT NULL, active TINYINT(1) DEFAULT NULL, create_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', edited_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_E1E0B40E4D16C4DD (shop_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE discount_mode (discount_id INT NOT NULL, mode_id INT NOT NULL, INDEX IDX_94842114C7C611F (discount_id), INDEX IDX_948421177E5854A (mode_id), PRIMARY KEY(discount_id, mode_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE discount ADD CONSTRAINT FK_E1E0B40E4D16C4DD FOREIGN KEY (shop_id) REFERENCES shop (id)');
$this->addSql('ALTER TABLE discount_mode ADD CONSTRAINT FK_94842114C7C611F FOREIGN KEY (discount_id) REFERENCES discount (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE discount_mode ADD CONSTRAINT FK_948421177E5854A FOREIGN KEY (mode_id) REFERENCES mode (id) ON DELETE CASCADE');
}
}