20080213maintenance.sql 844 B

12345678910111213141516171819202122
  1. -- These queries will cleanup your tables from an already
  2. -- fixed bug where a player that deleted a friend
  3. -- stood in the ex-friend contacts list.
  4. --
  5. -- If your L2J server setup was born after Core release 1711
  6. -- you won't need to run this script. Else you might want to
  7. -- run it just once. (Running it again shouldn't have any
  8. -- effect.)
  9. CREATE TABLE tmp_friends(char_id INT, friend_id INT);
  10. INSERT INTO tmp_friends
  11. (char_id, friend_id)
  12. SELECT CF1.char_id, CF1.friend_id FROM character_friends AS CF1 WHERE CF1.char_id NOT IN
  13. (SELECT CF2.friend_id FROM character_friends AS CF2 WHERE CF2.char_id = CF1.friend_id);
  14. DELETE FROM character_friends using character_friends
  15. INNER JOIN tmp_friends AS TF
  16. ON character_friends.char_id = TF.char_id
  17. AND character_friends.friend_id = TF.friend_id;
  18. DROP TABLE tmp_friends;