From: Tim Düsterhus Date: Mon, 23 Nov 2020 15:57:40 +0000 (+0100) Subject: Add multi-factor foreign keys to update_com.woltlab.wcf_5.4_db.php X-Git-Tag: 5.4.0_Alpha_1~555^2~36 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ce3466764aae76045c9408e0fc9874986e09e1cf;p=GitHub%2FWoltLab%2FWCF.git Add multi-factor foreign keys to update_com.woltlab.wcf_5.4_db.php --- diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_db.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_db.php index 48e76b5ce6..506c389907 100644 --- a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_db.php +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.4_db.php @@ -10,6 +10,7 @@ use wcf\system\database\table\column\TextDatabaseTableColumn; use wcf\system\database\table\column\VarbinaryDatabaseTableColumn; use wcf\system\database\table\DatabaseTable; 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\index\DatabaseTablePrimaryIndex; use wcf\system\database\table\PartialDatabaseTable; @@ -61,6 +62,18 @@ $tables = [ DatabaseTableIndex::create() ->type(DatabaseTableIndex::UNIQUE_TYPE) ->columns(['userID', 'objectTypeID']), + ]) + ->foreignKeys([ + DatabaseTableForeignKey::create() + ->columns(['userID']) + ->referencedTable('wcf1_user') + ->referencedColumns(['userID']) + ->onDelete('CASCADE'), + DatabaseTableForeignKey::create() + ->columns(['objectTypeID']) + ->referencedTable('wcf1_object_type') + ->referencedColumns(['objectTypeID']) + ->onDelete('CASCADE'), ]), DatabaseTable::create('wcf1_user_multifactor_backup') @@ -77,6 +90,13 @@ $tables = [ DatabaseTableIndex::create() ->type(DatabaseTableIndex::UNIQUE_TYPE) ->columns(['setupID', 'identifier']), + ]) + ->foreignKeys([ + DatabaseTableForeignKey::create() + ->columns(['setupID']) + ->referencedTable('wcf1_user_multifactor') + ->referencedColumns(['setupID']) + ->onDelete('CASCADE'), ]), DatabaseTable::create('wcf1_user_multifactor_email') @@ -89,6 +109,13 @@ $tables = [ DatabaseTableIndex::create() ->type(DatabaseTableIndex::UNIQUE_TYPE) ->columns(['setupID', 'code']), + ]) + ->foreignKeys([ + DatabaseTableForeignKey::create() + ->columns(['setupID']) + ->referencedTable('wcf1_user_multifactor') + ->referencedColumns(['setupID']) + ->onDelete('CASCADE'), ]), DatabaseTable::create('wcf1_user_multifactor_totp') @@ -109,6 +136,13 @@ $tables = [ DatabaseTableIndex::create() ->type(DatabaseTableIndex::UNIQUE_TYPE) ->columns(['setupID', 'deviceID']), + ]) + ->foreignKeys([ + DatabaseTableForeignKey::create() + ->columns(['setupID']) + ->referencedTable('wcf1_user_multifactor') + ->referencedColumns(['setupID']) + ->onDelete('CASCADE'), ]), ];