rlgallery-misc/py/cleandb.py
John "Elwin" Edwards f272772dcb Change the Python module's name back to rlgall.
It is no longer an experimental variant.  Using a database as a backend
is a settled feature.
2014-01-02 13:09:48 -05:00

20 lines
397 B
Python
Executable file

#!/usr/bin/python3
# cleandb.py: empty the database in an orderly fashion
import rlgall
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()