<?php declare(strict_types=1);
namespace Huebert\CustomDocuments;
use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
class HuebertCustomDocuments extends Plugin
{
public function uninstall( UninstallContext $uninstallContext ): void
{
$uninstallContext->setAutoMigrate( false ); // disable auto migration execution
$migrationCollection = $uninstallContext->getMigrationCollection(); // get migration collection
if ( $uninstallContext->keepUserData() === false ) {
# @TODO fix destructive method todiscard foreign keys in first place
$migrationCollection->migrateDestructiveInPlace( 1641832837 ); // call AddHueCustomDocumentId
#$migrationCollection->migrateDestructiveInPlace( 1641832870 ); // call CustomDocumentTranslation
#$migrationCollection->migrateDestructiveInPlace( 1641832837 ); // call CustomDocument
/** @var Connection $connection */
$connection = $this->container->get(Connection::class);
$connection->executeStatement('DROP TABLE IF EXISTS `hue_custom_document_translation`');
$connection->executeStatement('DROP TABLE IF EXISTS `hue_custom_document`');
}
}
}