Skip to content

Commit

Permalink
Remove favorites of deleted users
Browse files Browse the repository at this point in the history
  • Loading branch information
svivian committed Nov 23, 2020
1 parent d9f19b6 commit e62344b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions qa-include/db/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
exit;
}

define('QA_DB_VERSION_CURRENT', 67);
define('QA_DB_VERSION_CURRENT', 68);


/**
Expand Down Expand Up @@ -1589,8 +1589,8 @@ function qa_db_upgrade_tables()
break;

case 67:
// ensure we don't have old userids lying around
if (!QA_FINAL_EXTERNAL_USERS) {
// ensure we don't have old userids lying around
qa_db_upgrade_query('ALTER TABLE ^messages MODIFY fromuserid ' . $definitions['messages']['fromuserid']);
qa_db_upgrade_query('ALTER TABLE ^messages MODIFY touserid ' . $definitions['messages']['touserid']);
qa_db_upgrade_query('UPDATE ^messages SET fromuserid=NULL WHERE fromuserid NOT IN (SELECT userid FROM ^users)');
Expand All @@ -1604,6 +1604,13 @@ function qa_db_upgrade_tables()
break;

// Up to here: Version 1.8

case 68:
// remove favorites of deleted users
qa_db_upgrade_query('DELETE FROM ^userfavorites WHERE entitytype="U" AND entityid NOT IN (SELECT userid FROM ^users)');
break;

// Up to here: Version 1.9
}

qa_db_set_db_version($newversion);
Expand Down

0 comments on commit e62344b

Please sign in to comment.