<!-- Non-critical database adjustments. -->
<instruction type="script" run="standalone">acp/update_com.woltlab.wcf_5.4_db.php</instruction>
+ <!-- Index updates for `wcf1_tag_to_object`. -->
+ <instruction type="script" run="standalone">acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step1.php</instruction>
+ <instruction type="script" run="standalone">acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step2.php</instruction>
+ <instruction type="script" run="standalone">acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step3.php</instruction>
+ <instruction type="script" run="standalone">acp/update_com.woltlab.wcf_5.4_wcf1_tag_to_object_step4.php</instruction>
+
<!-- Cleanup of the filesystem. -->
<instruction type="script" run="standalone">acp/update_com.woltlab.wcf_5.4_removeFiles.php</instruction>
--- /dev/null
+<?php
+
+/**
+ * First step of the updates to the `wcf1_tag_to_object` table.
+ *
+ * The foreign keys needs to be dropped first because they required the dropped indices.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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();
--- /dev/null
+<?php
+
+/**
+ * Second step of the updates to the `wcf1_tag_to_object` table.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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();
--- /dev/null
+<?php
+
+/**
+ * Third step of the updates to the `wcf1_tag_to_object` table.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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();
--- /dev/null
+<?php
+
+/**
+ * Fourth step of the updates to the `wcf1_tag_to_object` table.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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();