Scripts for rlgallery.org, using a PostgreSQL backend. The recorder system is in py/, CGI scripts are in web/.
20 lines
408 B
Python
20 lines
408 B
Python
#!/usr/bin/python
|
|
# cleandb.py: empty the database in an orderly fashion
|
|
|
|
import rlgalldb as 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()
|