]> de.git.xonotic.org Git - xonotic/xonstatdb.git/blobdiff - tables/player_weapon_stats.tab
Add nick to player_weapon_stats to give anonymous players uniqueness (they always...
[xonotic/xonstatdb.git] / tables / player_weapon_stats.tab
index 07a8ca5136c48e1e31b89ca5bc43a7ee8dc488cc..888b547613bbf809e68652806fd7c17aa8c3cbf4 100644 (file)
@@ -1,13 +1,16 @@
 CREATE TABLE xonstat.player_weapon_stats
 (
-  player_weapon_stats_id serial NOT NULL,
+  player_weapon_stats_id bigserial NOT NULL,
   player_id integer NOT NULL,
   game_id bigint NOT NULL,
-  weapon_cd character varying(3) NOT NULL,
-  actual integer NOT NULL,
-  max integer NOT NULL,
-  frags integer NOT NULL,
-  create_dt timestamp with time zone NOT NULL DEFAULT now(),
+  nick character varying(64),
+  weapon_cd character varying(15) NOT NULL,
+  actual integer NOT NULL default 0,
+  max integer NOT NULL default 0,
+  hit integer NOT NULL default 0,
+  fired integer NOT NULL default 0,
+  frags integer NOT NULL default 0,
+  create_dt timestamp without time zone NOT NULL DEFAULT now(),
   CONSTRAINT player_weapon_stats_pk PRIMARY KEY (player_weapon_stats_id),
   CONSTRAINT player_weapon_stats_fk001 FOREIGN KEY (player_id)
       REFERENCES xonstat.players (player_id) MATCH SIMPLE
@@ -18,9 +21,64 @@ CREATE TABLE xonstat.player_weapon_stats
   CONSTRAINT player_weapon_stats_fk003 FOREIGN KEY (weapon_cd)
       REFERENCES xonstat.cd_weapon (weapon_cd) MATCH SIMPLE
       ON UPDATE NO ACTION ON DELETE NO ACTION,
-  CONSTRAINT player_weapon_stats_uk001 UNIQUE (player_id, game_id, weapon_cd)
+  CONSTRAINT player_weapon_stats_uk001 UNIQUE (player_id, game_id, weapon_cd, nick)
 )
 WITH (
   OIDS=FALSE
 );
+CREATE INDEX player_weap_stats_ix01 on player_weapon_stats(create_dt);
 ALTER TABLE xonstat.player_weapon_stats OWNER TO xonstat;
+
+CREATE TABLE xonstat.player_weapon_stats_2011Q2 (
+    CHECK ( create_dt >= DATE '2011-04-01' AND create_dt < DATE '2011-07-01' ) 
+) INHERITS (player_weapon_stats);
+CREATE INDEX player_weap_stats_2011Q2_ix01 on player_weapon_stats_2011Q2(create_dt);
+ALTER TABLE xonstat.player_weapon_stats_2011Q2 OWNER TO xonstat;
+
+CREATE TABLE xonstat.player_weapon_stats_2011Q3 ( 
+    CHECK ( create_dt >= DATE '2011-07-01' AND create_dt < DATE '2011-10-01' ) 
+) INHERITS (player_weapon_stats);
+CREATE INDEX player_weap_stats_2011Q3_ix01 on player_weapon_stats_2011Q3(create_dt);
+ALTER TABLE xonstat.player_weapon_stats_2011Q3 OWNER TO xonstat;
+
+CREATE TABLE xonstat.player_weapon_stats_2011Q4 ( 
+    CHECK ( create_dt >= DATE '2011-10-01' AND create_dt < DATE '2012-01-01' ) 
+) INHERITS (player_weapon_stats);
+CREATE INDEX player_weap_stats_2011Q4_ix01 on player_weapon_stats_2011Q4(create_dt);
+ALTER TABLE xonstat.player_weapon_stats_2011Q4 OWNER TO xonstat;
+
+CREATE TABLE xonstat.player_weapon_stats_2012Q1 ( 
+    CHECK ( create_dt >= DATE '2012-01-01' AND create_dt < DATE '2012-04-01' ) 
+) INHERITS (player_weapon_stats);
+CREATE INDEX player_weap_stats_2012Q1_ix01 on player_weapon_stats_2012Q1(create_dt);
+ALTER TABLE xonstat.player_weapon_stats_2012Q1 OWNER TO xonstat;
+
+CREATE TABLE xonstat.player_weapon_stats_2012Q2 ( 
+    CHECK ( create_dt >= DATE '2012-04-01' AND create_dt < DATE '2012-07-01' ) 
+) INHERITS (player_weapon_stats);
+CREATE INDEX player_weap_stats_2012Q2_ix01 on player_weapon_stats_2012Q2(create_dt);
+ALTER TABLE xonstat.player_weapon_stats_2012Q2 OWNER TO xonstat;
+
+CREATE TABLE xonstat.player_weapon_stats_2012Q3 ( 
+    CHECK ( create_dt >= DATE '2012-07-01' AND create_dt < DATE '2012-10-01' ) 
+) INHERITS (player_weapon_stats);
+CREATE INDEX player_weap_stats_2012Q3_ix01 on player_weapon_stats_2012Q3(create_dt);
+ALTER TABLE xonstat.player_weapon_stats_2012Q3 OWNER TO xonstat;
+
+CREATE TABLE xonstat.player_weapon_stats_2012Q4 ( 
+    CHECK ( create_dt >= DATE '2012-10-01' AND create_dt < DATE '2013-01-01' ) 
+) INHERITS (player_weapon_stats);
+CREATE INDEX player_weap_stats_2012Q4_ix01 on player_weapon_stats_2012Q4(create_dt);
+ALTER TABLE xonstat.player_weapon_stats_2012Q4 OWNER TO xonstat;
+
+CREATE TABLE xonstat.player_weapon_stats_2013Q1 ( 
+    CHECK ( create_dt >= DATE '2013-01-01' AND create_dt < DATE '2013-04-01' ) 
+) INHERITS (player_weapon_stats);
+CREATE INDEX player_weap_stats_2013Q1_ix01 on player_weapon_stats_2013Q1(create_dt);
+ALTER TABLE xonstat.player_weapon_stats_2013Q1 OWNER TO xonstat;
+
+CREATE TABLE xonstat.player_weapon_stats_2013Q2 ( 
+    CHECK ( create_dt >= DATE '2013-04-01' AND create_dt < DATE '2013-07-01' ) 
+) INHERITS (player_weapon_stats);
+CREATE INDEX player_weap_stats_2013Q2_ix01 on player_weapon_stats_2013Q2(create_dt);
+ALTER TABLE xonstat.player_weapon_stats_2013Q2 OWNER TO xonstat;