Ulysses

General => Developers Corner => Topic started by: kmiller on March 30, 2020, 08:08:41 PM

Title: uTime Cleanup
Post by: kmiller on March 30, 2020, 08:08:41 PM
Hello.

Are there any simple scripts that clear people's data if they haven't joined in the last year or so? This would be very useful because my sv.db is very full and it could do with a good clean up.
Title: Re: uTime Cleanup
Post by: MrPresident on March 31, 2020, 12:35:01 AM
Code: [Select]
sql.Query( "DELETE FROM utime WHERE lastvisit < " .. os.time() - 365*24*60*30 )


Doesn't get much more simple that that. :)


You can just run that on your server with lua_run from your server console if you want, or make it into some kind of addon.
Title: Re: uTime Cleanup
Post by: MrPresident on March 31, 2020, 12:36:28 AM
If you are curious how many people are in that window.. you can run this in your server console and it'll output how many people in your console.
Code: [Select]
lua_run print( #sql.Query( "SELECT * FROM utime WHERE lastvisit < " .. os.time() - 365*24*60*30) or {"NONE"} )
Title: Re: uTime Cleanup
Post by: kmiller on March 31, 2020, 07:22:55 AM
Perfect. Thank you!