<?php declare(strict_types=1);
namespace Acris\RuleSurchargeDiscount;
use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
class AcrisRuleSurchargeDiscountCS extends Plugin
{
public function uninstall(UninstallContext $context): void
{
if ($context->keepUserData()) {
return;
}
$this->cleanupDatabase();
}
private function cleanupDatabase(): void
{
$connection = $this->container->get(Connection::class);
$connection->executeStatement('ALTER TABLE rule DROP COLUMN discountSurchargeDiscount');
$connection->executeStatement('ALTER TABLE rule DROP COLUMN surchargeDiscount');
$connection->executeStatement('ALTER TABLE sales_channel DROP COLUMN surchargeDiscount');
$connection->executeStatement('DROP TABLE IF EXISTS acris_rule_s_d_discount_rules');
$connection->executeStatement('DROP TABLE IF EXISTS acris_rule_s_d_sales_channel');
$connection->executeStatement('DROP TABLE IF EXISTS acris_rule_s_d_rules');
$connection->executeStatement('DROP TABLE IF EXISTS acris_rule_s_d_translation');
$connection->executeStatement('DROP TABLE IF EXISTS acris_rule_s_d');
}
}