Rearranged order of update calls

This commit is contained in:
Michael 2021-02-02 06:05:50 +00:00
parent 48ba88b11c
commit 9f37a4d9a0

View file

@ -717,7 +717,24 @@ function update_1396()
function update_1397()
{
if (!DBStructure::existsTable('thread') || !DBStructure::existsTable('user-item')) {
if (!DBA::e("INSERT INTO `post-user-notification`(`uri-id`, `uid`, `notification-type`)
SELECT `uri-id`, `uid`, `notification-type` FROM `post-user` WHERE `notification-type` != 0
ON DUPLICATE KEY UPDATE `uri-id` = `post-user`.`uri-id`, `uid` = `post-user`.`uid`, `notification-type` = `post-user`.`notification-type`")) {
return Update::FAILED;
}
if (!DBStructure::existsTable('user-item')) {
return Update::SUCCESS;
}
if (!DBA::e("INSERT INTO `post-user-notification`(`uri-id`, `uid`, `notification-type`)
SELECT `uri-id`, `user-item`.`uid`, `notification-type` FROM `user-item`
INNER JOIN `item` ON `item`.`id` = `user-item`.`iid` WHERE `notification-type` != 0
ON DUPLICATE KEY UPDATE `notification-type` = `user-item`.`notification-type`")) {
return Update::FAILED;
}
if (!DBStructure::existsTable('thread')) {
return Update::SUCCESS;
}
@ -728,18 +745,5 @@ function update_1397()
return Update::FAILED;
}
if (!DBA::e("INSERT INTO `post-user-notification`(`uri-id`, `uid`, `notification-type`)
SELECT `uri-id`, `user-item`.`uid`, `notification-type` FROM `user-item`
INNER JOIN `item` ON `item`.`id` = `user-item`.`iid` WHERE `notification-type` != 0
ON DUPLICATE KEY UPDATE `notification-type` = `user-item`.`notification-type`")) {
return Update::FAILED;
}
if (!DBA::e("INSERT IGNORE INTO `post-user-notification`(`uri-id`, `uid`, `notification-type`)
SELECT `uri-id`, `uid`, `notification-type` FROM `post-user` WHERE `notification-type` != 0
ON DUPLICATE KEY UPDATE `uri-id` = `post-user`.`uri-id`, `uid` = `post-user`.`uid`, `notification-type` = `post-user`.`notification-type`")) {
return Update::FAILED;
}
return Update::SUCCESS;
}