data for places and to archive match points
[brisk.git] / sql / sql.d / 051-bin5-places.sql
diff --git a/sql/sql.d/051-bin5-places.sql b/sql/sql.d/051-bin5-places.sql
new file mode 100644 (file)
index 0000000..ebf3add
--- /dev/null
@@ -0,0 +1,25 @@
+--
+-- try to start with a single table for all placings
+--
+-- tri = 0     lo = 0
+-- mon = 2     hi = 1
+-- wee = 4
+--
+
+DROP   TABLE #PFX#bin5_places_mtime;
+CREATE TABLE #PFX#bin5_places_mtime (
+       code   int,
+       mtime  timestamp
+);
+INSERT INTO #PFX#bin5_places_mtime (code, mtime) VALUES (0, now());
+
+DROP   TABLE #PFX#bin5_places;
+CREATE TABLE #PFX#bin5_places (
+       type   integer,
+       rank   integer,
+       ucode  integer REFERENCES #PFX#users (code) ON DELETE cascade ON UPDATE cascade, 
+       login  text,
+       pts    integer,
+       games  integer,
+       score  float
+);