From 73b5cc5000a833e809de6305e93a88ee3e847f39 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Fri, 29 Jan 2021 17:31:38 +0100 Subject: [PATCH] Add update instructions for index updates of `wcf1_tag_to_object` --- com.woltlab.wcf/package.xml | 6 ++ ...ltlab.wcf_5.4_wcf1_tag_to_object_step1.php | 59 +++++++++++++++++++ ...ltlab.wcf_5.4_wcf1_tag_to_object_step2.php | 32 ++++++++++ ...ltlab.wcf_5.4_wcf1_tag_to_object_step3.php | 49 +++++++++++++++ ...ltlab.wcf_5.4_wcf1_tag_to_object_step4.php | 33 +++++++++++ 5 files changed, 179 insertions(+) create mode 100644 wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step1.php create mode 100644 wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step2.php create mode 100644 wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step3.php create mode 100644 wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step4.php diff --git a/com.woltlab.wcf/package.xml b/com.woltlab.wcf/package.xml index 8ca2bdf808..9f9906faa2 100644 --- a/com.woltlab.wcf/package.xml +++ b/com.woltlab.wcf/package.xml @@ -88,6 +88,12 @@ tar cvf com.woltlab.wcf/files_pre.tar -C wcfsetup/install/files/ \ acp/update_com.woltlab.wcf_5.4_db.php + + acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step1.php + acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step2.php + acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step3.php + acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step4.php + acp/update_com.woltlab.wcf_5.4_removeFiles.php diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step1.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step1.php new file mode 100644 index 0000000000..2cf146b83f --- /dev/null +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step1.php @@ -0,0 +1,59 @@ + + * @package WoltLabSuite\Core + */ + +use wcf\system\database\table\DatabaseTableChangeProcessor; +use wcf\system\database\table\index\DatabaseTableForeignKey; +use wcf\system\database\table\index\DatabaseTableIndex; +use wcf\system\database\table\PartialDatabaseTable; +use wcf\system\package\plugin\ScriptPackageInstallationPlugin; +use wcf\system\WCF; + +$tables = [ + PartialDatabaseTable::create('wcf1_tag_to_object') + ->foreignKeys([ + DatabaseTableForeignKey::create() + ->columns(['tagID']) + ->referencedTable('wcf1_tag') + ->referencedColumns(['tagID']) + ->onDelete('CASCADE') + ->drop(), + DatabaseTableForeignKey::create() + ->columns(['languageID']) + ->referencedTable('wcf1_language') + ->referencedColumns(['languageID']) + ->onDelete('CASCADE') + ->drop(), + DatabaseTableForeignKey::create() + ->columns(['objectTypeID']) + ->referencedTable('wcf1_object_type') + ->referencedColumns(['objectTypeID']) + ->onDelete('CASCADE') + ->drop(), + ]) + ->indices([ + DatabaseTableIndex::create() + ->columns(['objectTypeID', 'languageID', 'objectID', 'tagID']) + ->type(DatabaseTableIndex::UNIQUE_TYPE) + ->drop(), + DatabaseTableIndex::create() + ->columns(['tagID', 'objectTypeID']) + ->drop(), + ]), +]; + +(new DatabaseTableChangeProcessor( + /** @var ScriptPackageInstallationPlugin $this */ + $this->installation->getPackage(), + $tables, + WCF::getDB()->getEditor() +))->process(); diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step2.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step2.php new file mode 100644 index 0000000000..2e5c31bbfd --- /dev/null +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step2.php @@ -0,0 +1,32 @@ + + * @package WoltLabSuite\Core + */ + +use wcf\system\database\table\DatabaseTableChangeProcessor; +use wcf\system\database\table\index\DatabaseTableIndex; +use wcf\system\database\table\PartialDatabaseTable; +use wcf\system\package\plugin\ScriptPackageInstallationPlugin; +use wcf\system\WCF; + +$tables = [ + PartialDatabaseTable::create('wcf1_tag_to_object') + ->indices([ + DatabaseTableIndex::create() + ->columns(['objectTypeID', 'languageID', 'tagID']) + ->drop(), + ]), +]; + +(new DatabaseTableChangeProcessor( + /** @var ScriptPackageInstallationPlugin $this */ + $this->installation->getPackage(), + $tables, + WCF::getDB()->getEditor() +))->process(); diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step3.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step3.php new file mode 100644 index 0000000000..742554fb3e --- /dev/null +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step3.php @@ -0,0 +1,49 @@ + + * @package WoltLabSuite\Core + */ + +use wcf\system\database\table\DatabaseTableChangeProcessor; +use wcf\system\database\table\index\DatabaseTableForeignKey; +use wcf\system\database\table\index\DatabaseTablePrimaryIndex; +use wcf\system\database\table\PartialDatabaseTable; +use wcf\system\package\plugin\ScriptPackageInstallationPlugin; +use wcf\system\WCF; + +$tables = [ + PartialDatabaseTable::create('wcf1_tag_to_object') + ->foreignKeys([ + DatabaseTableForeignKey::create() + ->columns(['tagID']) + ->referencedTable('wcf1_tag') + ->referencedColumns(['tagID']) + ->onDelete('CASCADE'), + DatabaseTableForeignKey::create() + ->columns(['languageID']) + ->referencedTable('wcf1_language') + ->referencedColumns(['languageID']) + ->onDelete('CASCADE'), + DatabaseTableForeignKey::create() + ->columns(['objectTypeID']) + ->referencedTable('wcf1_object_type') + ->referencedColumns(['objectTypeID']) + ->onDelete('CASCADE'), + ]) + ->indices([ + DatabaseTablePrimaryIndex::create() + ->columns(['objectTypeID', 'objectID', 'tagID']), + ]), +]; + +(new DatabaseTableChangeProcessor( + /** @var ScriptPackageInstallationPlugin $this */ + $this->installation->getPackage(), + $tables, + WCF::getDB()->getEditor() +))->process(); diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step4.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step4.php new file mode 100644 index 0000000000..c9ad57aee0 --- /dev/null +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step4.php @@ -0,0 +1,33 @@ + + * @package WoltLabSuite\Core + */ + +use wcf\system\database\table\DatabaseTableChangeProcessor; +use wcf\system\database\table\index\DatabaseTableIndex; +use wcf\system\database\table\PartialDatabaseTable; +use wcf\system\package\plugin\ScriptPackageInstallationPlugin; +use wcf\system\WCF; + +$tables = [ + PartialDatabaseTable::create('wcf1_tag_to_object') + ->indices([ + DatabaseTableIndex::create() + ->columns(['objectTypeID', 'tagID']), + DatabaseTableIndex::create() + ->columns(['tagID']), + ]), +]; + +(new DatabaseTableChangeProcessor( + /** @var ScriptPackageInstallationPlugin $this */ + $this->installation->getPackage(), + $tables, + WCF::getDB()->getEditor() +))->process(); -- 2.20.1