From: Alexander Ebert Date: Sat, 22 Jun 2024 12:07:51 +0000 (+0200) Subject: Add a workaround for the migration of the spider data X-Git-Tag: 6.1.0_Alpha_1~53 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=00c23304860ba80df8456e52898ad0c9bcaec00d;p=GitHub%2FWoltLab%2FWCF.git Add a workaround for the migration of the spider data Fixes #5941 --- diff --git a/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.1_spider_step1.php b/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.1_spider_step1.php deleted file mode 100644 index b807f63cc8..0000000000 --- a/wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.1_spider_step1.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @since 6.1 - */ - -use wcf\system\database\table\column\IntDatabaseTableColumn; -use wcf\system\database\table\index\DatabaseTableForeignKey; -use wcf\system\database\table\index\DatabaseTableIndex; -use wcf\system\database\table\PartialDatabaseTable; - -return [ - PartialDatabaseTable::create('wcf1_session') - ->columns([ - IntDatabaseTableColumn::create('spiderID') - ->length(10) - ->drop(), - ]) - ->indices([ - DatabaseTableIndex::create('packageID') - ->columns(['lastActivityTime', 'spiderID']) - ->drop(), - ]) - ->foreignKeys([ - DatabaseTableForeignKey::create() - ->columns(['spiderID']) - ->referencedTable('wcf1_spider') - ->referencedColumns(['spiderID']) - ->onDelete('CASCADE') - ->drop(), - ]), -]; diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_6.1_spider_step1.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_6.1_spider_step1.php new file mode 100644 index 0000000000..cf91642998 --- /dev/null +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_6.1_spider_step1.php @@ -0,0 +1,57 @@ + + * @since 6.1 + */ + +use wcf\system\database\table\column\IntDatabaseTableColumn; +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\WCF; + +$tableNames = WCF::getDB()->getEditor()->getTableNames(); +if (!\in_array('wcf' . WCF_N . '_spider', $tableNames)) { + // The table `wcf1_spider` will be removed by a database PIP that is + // executed after this script. + return; +} + +$tables = [ + PartialDatabaseTable::create('wcf1_session') + ->columns([ + IntDatabaseTableColumn::create('spiderID') + ->length(10) + ->drop(), + ]) + ->indices([ + DatabaseTableIndex::create('packageID') + ->columns(['lastActivityTime', 'spiderID']) + ->drop(), + ]) + ->foreignKeys([ + // This foreign key definition fails to validate when the table + // `wcf1_spider` no longer exists, despite it being scheduled for + // removal. + DatabaseTableForeignKey::create() + ->columns(['spiderID']) + ->referencedTable('wcf1_spider') + ->referencedColumns(['spiderID']) + ->onDelete('CASCADE') + ->drop(), + ]), +]; + +(new DatabaseTableChangeProcessor( + /** @var ScriptPackageInstallationPlugin $this */ + $this->installation->getPackage(), + $tables, + WCF::getDB()->getEditor() +) +)->process();