custom/plugins/AcrisRuleSurchargeDiscountCS/src/AcrisRuleSurchargeDiscountCS.php line 9

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Acris\RuleSurchargeDiscount;
  3. use Doctrine\DBAL\Connection;
  4. use Shopware\Core\Framework\Plugin;
  5. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  6. class AcrisRuleSurchargeDiscountCS extends Plugin
  7. {
  8.     public function uninstall(UninstallContext $context): void
  9.     {
  10.         if ($context->keepUserData()) {
  11.             return;
  12.         }
  13.         $this->cleanupDatabase();
  14.     }
  15.     private function cleanupDatabase(): void
  16.     {
  17.         $connection $this->container->get(Connection::class);
  18.         $connection->executeStatement('ALTER TABLE rule DROP COLUMN discountSurchargeDiscount');
  19.         $connection->executeStatement('ALTER TABLE rule DROP COLUMN surchargeDiscount');
  20.         $connection->executeStatement('ALTER TABLE sales_channel DROP COLUMN surchargeDiscount');
  21.         $connection->executeStatement('DROP TABLE IF EXISTS acris_rule_s_d_discount_rules');
  22.         $connection->executeStatement('DROP TABLE IF EXISTS acris_rule_s_d_sales_channel');
  23.         $connection->executeStatement('DROP TABLE IF EXISTS acris_rule_s_d_rules');
  24.         $connection->executeStatement('DROP TABLE IF EXISTS acris_rule_s_d_translation');
  25.         $connection->executeStatement('DROP TABLE IF EXISTS acris_rule_s_d');
  26.     }
  27. }