Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 Server Modifications ONLY!
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 06.03.2007, 08:47   #1
srh
Архивный участник
 
Join Date: Aug 2005
Posts: 145
Default [share] sql. cleanup deleted chars.

this code cleanup database after char get deleted.
before use any script - backup your db
Code:
begin tran
delete from bookmark where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from nobless_achievements where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from olympiad_match where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from olympiad_result where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from Quest where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from shortcut_data where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from ssq_user_data where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_ActiveSkill where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_ban where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_blocklist where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_comment where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_deleted where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_friend where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_henna where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_history where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_item where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_log where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));

delete from user_macroinfo where macro_id in (SELECT macro_id FROM user_macro WHERE char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1)));
delete from user_macro where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));

delete from user_mail where id in (SELECT mail_id FROM user_mail_receiver WHERE receiver_id in (select char_id from user_data where (account_id = - 1)));
delete from user_mail where id in (SELECT mail_id FROM user_mail_sender WHERE sender_id in (select char_id from user_data where (account_id = - 1)));
delete from user_mail_receiver where receiver_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_mail_sender where sender_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));

delete from user_newbie where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_nobless where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_punish where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_recipe where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_skill where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_sociality where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_subjob where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete from user_surrender where char_id in (SELECT char_id FROM user_data WHERE (account_id = - 1));
delete FROM user_data WHERE (account_id = - 1);
commit
if someone know how to clean up pet_data this will be nice.
comments/suggestions are welcome.

if u need to delete accounts that not used in 180 days change (account_id = -1) to (login < GETDATE() - 180)

in next script we cleanup accounts that do not have any char
srh is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 23:28.