From fee128811e6c972dca8c0cf88f34ff7dd2e5d648 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Tue, 19 Jul 2016 15:54:54 +0200 Subject: [PATCH] Fixed deinstallation of foreign keys --- .../plugin/SQLPackageInstallationPlugin.class.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php index 6c1872afb0..563a280ed9 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php @@ -83,10 +83,17 @@ class SQLPackageInstallationPlugin extends AbstractPackageInstallationPlugin { */ public function uninstall() { // get logged sql tables/columns - $sql = "SELECT * + $sql = "SELECT wcf".WCF_N."_package_installation_sql_log.*, + CASE WHEN sqlIndex <> '' THEN 1 ELSE 0 END AS isIndex, + CASE WHEN sqlColumn <> '' THEN 1 ELSE 0 END AS isColumn, + CASE WHEN SUBSTRING(sqlIndex, -3) = '_fk' THEN 1 ELSE 0 END AS isForeignKey FROM wcf".WCF_N."_package_installation_sql_log WHERE packageID = ? - ORDER BY sqlIndex DESC, sqlColumn DESC"; + ORDER BY isIndex DESC, + isForeignKey DESC, + sqlIndex, + isColumn DESC, + sqlColumn"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute([$this->installation->getPackageID()]); $entries = $statement->fetchAll(\PDO::FETCH_ASSOC); -- 2.20.1