view py/cleandb.py @ 44:7c789e87ee5d

Rearrange the statistics pages. Move each game's charts onto individual pages. Put links to these pages on /scoring/index.html, instead of dumping all the charts there.
author John "Elwin" Edwards
date Thu, 16 Jan 2014 11:04:45 -0800
parents 25843238434a
children
line wrap: on
line source

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