]> de.git.xonotic.org Git - xonotic/xonstatdb.git/blobdiff - tables/games.tab
Partition games through 2014.
[xonotic/xonstatdb.git] / tables / games.tab
old mode 100644 (file)
new mode 100755 (executable)
index fe76771..3ff3a4d
@@ -7,6 +7,8 @@ CREATE TABLE xonstat.games
   map_id integer NOT NULL,
   duration interval,
   winner integer,
+  match_id character varying(64),
+  mod character varying(64),
   create_dt timestamp without time zone NOT NULL DEFAULT (current_timestamp at time zone 'UTC'),
   CONSTRAINT games_pk PRIMARY KEY (game_id),
   CONSTRAINT games_fk001 FOREIGN KEY (game_type_cd)
@@ -17,7 +19,8 @@ CREATE TABLE xonstat.games
       ON UPDATE NO ACTION ON DELETE NO ACTION,
   CONSTRAINT games_fk003 FOREIGN KEY (map_id)
       REFERENCES xonstat.maps (map_id) MATCH SIMPLE
-      ON UPDATE NO ACTION ON DELETE NO ACTION
+      ON UPDATE NO ACTION ON DELETE NO ACTION,
+  CONSTRAINT games_uk001 UNIQUE (server_id, match_id)
 )
 WITH (
   OIDS=FALSE
@@ -25,6 +28,7 @@ WITH (
 CREATE INDEX games_ix001 on games(create_dt);
 ALTER TABLE xonstat.games OWNER TO xonstat;
 
+-- 2011
 CREATE TABLE xonstat.games_2011Q2 (
     CHECK ( create_dt >= DATE '2011-04-01' AND create_dt < DATE '2011-07-01' ) 
 ) INHERITS (games);
@@ -43,6 +47,7 @@ CREATE TABLE xonstat.games_2011Q4 (
 CREATE INDEX games_2011Q4_ix001 on games_2011Q4(create_dt);
 ALTER TABLE xonstat.games_2011Q4 OWNER TO xonstat;
 
+-- 2012
 CREATE TABLE xonstat.games_2012Q1 ( 
     CHECK ( create_dt >= DATE '2012-01-01' AND create_dt < DATE '2012-04-01' ) 
 ) INHERITS (games);
@@ -67,6 +72,7 @@ CREATE TABLE xonstat.games_2012Q4 (
 CREATE INDEX games_2012Q4_ix001 on games_2012Q4(create_dt);
 ALTER TABLE xonstat.games_2012Q4 OWNER TO xonstat;
 
+-- 2013
 CREATE TABLE xonstat.games_2013Q1 ( 
     CHECK ( create_dt >= DATE '2013-01-01' AND create_dt < DATE '2013-04-01' ) 
 ) INHERITS (games);
@@ -78,3 +84,40 @@ CREATE TABLE xonstat.games_2013Q2 (
 ) INHERITS (games);
 CREATE INDEX games_2013Q2_ix001 on games_2013Q2(create_dt);
 ALTER TABLE xonstat.games_2013Q2 OWNER TO xonstat;
+
+CREATE TABLE xonstat.games_2013Q3 ( 
+    CHECK ( create_dt >= DATE '2013-07-01' AND create_dt < DATE '2013-10-01' ) 
+) INHERITS (games);
+CREATE INDEX games_2013Q3_ix001 on games_2013Q3(create_dt);
+ALTER TABLE xonstat.games_2013Q3 OWNER TO xonstat;
+
+CREATE TABLE xonstat.games_2013Q4 ( 
+    CHECK ( create_dt >= DATE '2013-10-01' AND create_dt < DATE '2014-01-01' ) 
+) INHERITS (games);
+CREATE INDEX games_2013Q4_ix001 on games_2013Q4(create_dt);
+ALTER TABLE xonstat.games_2013Q4 OWNER TO xonstat;
+
+-- 2014
+CREATE TABLE xonstat.games_2014Q1 ( 
+    CHECK ( create_dt >= DATE '2014-01-01' AND create_dt < DATE '2014-04-01' ) 
+) INHERITS (games);
+CREATE INDEX games_2014Q1_ix001 on games_2014Q1(create_dt);
+ALTER TABLE xonstat.games_2014Q1 OWNER TO xonstat;
+
+CREATE TABLE xonstat.games_2014Q2 ( 
+    CHECK ( create_dt >= DATE '2014-04-01' AND create_dt < DATE '2014-07-01' ) 
+) INHERITS (games);
+CREATE INDEX games_2014Q2_ix001 on games_2014Q2(create_dt);
+ALTER TABLE xonstat.games_2014Q2 OWNER TO xonstat;
+
+CREATE TABLE xonstat.games_2014Q3 ( 
+    CHECK ( create_dt >= DATE '2014-07-01' AND create_dt < DATE '2014-10-01' ) 
+) INHERITS (games);
+CREATE INDEX games_2014Q3_ix001 on games_2014Q3(create_dt);
+ALTER TABLE xonstat.games_2014Q3 OWNER TO xonstat;
+
+CREATE TABLE xonstat.games_2014Q4 ( 
+    CHECK ( create_dt >= DATE '2014-10-01' AND create_dt < DATE '2014-01-01' ) 
+) INHERITS (games);
+CREATE INDEX games_2014Q4_ix001 on games_2014Q4(create_dt);
+ALTER TABLE xonstat.games_2014Q4 OWNER TO xonstat;