From 60a5e9e5cc7b2f375f653f4db40e5d63ffd1936e Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 10 Nov 2019 10:37:54 +0100 Subject: [PATCH] Make `wcf1_package.package` have a unique key Close #3099 --- com.woltlab.wcf/package.xml | 1 + .../update-com.woltlab.wcf_5.2.0_beta_3.php | 34 +++++++++++++++++++ wcfsetup/setup/db/install.sql | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 wcfsetup/install/files/acp/update-com.woltlab.wcf_5.2.0_beta_3.php diff --git a/com.woltlab.wcf/package.xml b/com.woltlab.wcf/package.xml index f50389fca9..e8fce6992f 100644 --- a/com.woltlab.wcf/package.xml +++ b/com.woltlab.wcf/package.xml @@ -54,6 +54,7 @@ acptemplates_update.tar files_update.tar templates_update.tar + acp/update-com.woltlab.wcf_5.2.0_beta_3.php diff --git a/wcfsetup/install/files/acp/update-com.woltlab.wcf_5.2.0_beta_3.php b/wcfsetup/install/files/acp/update-com.woltlab.wcf_5.2.0_beta_3.php new file mode 100644 index 0000000000..dee5ddc892 --- /dev/null +++ b/wcfsetup/install/files/acp/update-com.woltlab.wcf_5.2.0_beta_3.php @@ -0,0 +1,34 @@ + + */ + +$tables = [ + PartialDatabaseTable::create('wcf1_package') + ->indices([ + DatabaseTableIndex::create('package') + ->columns(['package']) + ->drop(), + + DatabaseTableIndex::create() + ->type(DatabaseTableIndex::UNIQUE_TYPE) + ->columns(['package']) + ]) +]; + +(new DatabaseTableChangeProcessor( +/** @var ScriptPackageInstallationPlugin $this */ + $this->installation->getPackage(), + $tables, + WCF::getDB()->getEditor()) +)->process(); diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index 5c751c48e1..2cf567d6e9 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -910,7 +910,7 @@ CREATE TABLE wcf1_package ( isApplication TINYINT(1) NOT NULL DEFAULT 0, author VARCHAR(255) NOT NULL DEFAULT '', authorURL VARCHAR(255) NOT NULL DEFAULT '', - KEY package (package) + UNIQUE KEY package (package) ); DROP TABLE IF EXISTS wcf1_package_compatibility; -- 2.20.1