2013-12-31 13:36:19 -05:00
|
|
|
#!/usr/bin/python3
|
2012-07-25 21:59:42 -07:00
|
|
|
# cleandb.py: empty the database in an orderly fashion
|
|
|
|
|
|
2014-01-02 13:09:48 -05:00
|
|
|
import rlgall
|
2012-07-25 21:59:42 -07:00
|
|
|
import psycopg2
|
|
|
|
|
|
|
|
|
|
dbconn = psycopg2.connect("dbname=rlg")
|
|
|
|
|
dbcur = dbconn.cursor()
|
|
|
|
|
|
|
|
|
|
dbcur.execute("UPDATE games SET offbytes = %s", [0])
|
|
|
|
|
|
|
|
|
|
for game in rlgall.gamelist:
|
|
|
|
|
dbcur.execute("DELETE FROM " + game.uname + ";")
|
|
|
|
|
|
|
|
|
|
dbcur.execute("DELETE FROM players;")
|
|
|
|
|
dbconn.commit()
|
|
|
|
|
|
|
|
|
|
dbcur.close()
|
|
|
|
|
dbconn.close()
|
|
|
|
|
exit()
|