From: Marcel Werk Date: Tue, 19 Jul 2016 13:54:54 +0000 (+0200) Subject: Fixed deinstallation of foreign keys X-Git-Tag: 3.0.0_Beta_1~1041 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fee128811e6c972dca8c0cf88f34ff7dd2e5d648;p=GitHub%2FWoltLab%2FWCF.git Fixed deinstallation of foreign keys --- 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);