view py/cleandb.py @ 25:dd72d2dd923f

Move the inprogress dirs into a single directory. The inprogress dirs are now at /dgldir/inprogress/$GAME instead of /dgldir/inprogress-$GAME. This is less cluttered and may be more convenient for watching.
author John "Elwin" Edwards
date Sun, 20 Oct 2013 19:05:58 -0700
parents 5ba2123d2c20
children e8f3b7994d88
line wrap: on
line source

#!/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()