]> git.xonotic.org Git - xonotic/xonstatdb.git/blob - tables/player_weapon_stats.tab
Partition player weapon stats through 2014.
[xonotic/xonstatdb.git] / tables / player_weapon_stats.tab
1 CREATE TABLE xonstat.player_weapon_stats
2 (
3   player_weapon_stats_id bigserial NOT NULL,
4   player_id integer NOT NULL,
5   game_id bigint NOT NULL,
6   player_game_stat_id bigint NOT NULL,
7   weapon_cd character varying(15) NOT NULL,
8   actual integer NOT NULL default 0,
9   max integer NOT NULL default 0,
10   hit integer NOT NULL default 0,
11   fired integer NOT NULL default 0,
12   frags integer NOT NULL default 0,
13   create_dt timestamp without time zone NOT NULL DEFAULT (current_timestamp at time zone 'UTC'),
14   CONSTRAINT player_weapon_stats_pk PRIMARY KEY (player_weapon_stats_id),
15   CONSTRAINT player_weapon_stats_fk001 FOREIGN KEY (player_id)
16       REFERENCES xonstat.players (player_id) MATCH SIMPLE
17       ON UPDATE NO ACTION ON DELETE NO ACTION,
18   CONSTRAINT player_weapon_stats_fk002 FOREIGN KEY (game_id)
19       REFERENCES xonstat.games (game_id) MATCH SIMPLE
20       ON UPDATE NO ACTION ON DELETE NO ACTION,
21   CONSTRAINT player_weapon_stats_fk003 FOREIGN KEY (weapon_cd)
22       REFERENCES xonstat.cd_weapon (weapon_cd) MATCH SIMPLE
23       ON UPDATE NO ACTION ON DELETE NO ACTION,
24   CONSTRAINT player_weapon_stats_fk004 FOREIGN KEY (player_game_stat_id)
25       REFERENCES xonstat.player_game_stats (player_game_stat_id) MATCH SIMPLE
26       ON UPDATE NO ACTION ON DELETE NO ACTION
27 )
28 WITH (
29   OIDS=FALSE
30 );
31
32 CREATE INDEX player_weap_stats_ix01 on player_weapon_stats(create_dt);
33 CREATE INDEX player_weap_stats_ix02 on player_weapon_stats(game_id);
34 CREATE INDEX player_weap_stats_ix03 on player_weapon_stats(player_id);
35
36 ALTER TABLE xonstat.player_weapon_stats OWNER TO xonstat;
37
38 -- 2011
39 CREATE TABLE xonstat.player_weapon_stats_2011Q2 (
40     CHECK ( create_dt >= DATE '2011-04-01' AND create_dt < DATE '2011-07-01' ) 
41 ) INHERITS (player_weapon_stats);
42
43 CREATE INDEX player_weap_stats_2011Q2_ix01 on player_weapon_stats_2011Q2(create_dt);
44 CREATE INDEX player_weap_stats_2011Q2_ix02 on player_weapon_stats_2011Q2(game_id);
45 CREATE INDEX player_weap_stats_2011Q2_ix03 on player_weapon_stats_2011Q2(player_id);
46 ALTER TABLE xonstat.player_weapon_stats_2011Q2 OWNER TO xonstat;
47
48 CREATE TABLE xonstat.player_weapon_stats_2011Q3 ( 
49     CHECK ( create_dt >= DATE '2011-07-01' AND create_dt < DATE '2011-10-01' ) 
50 ) INHERITS (player_weapon_stats);
51
52 CREATE INDEX player_weap_stats_2011Q3_ix01 on player_weapon_stats_2011Q3(create_dt);
53 CREATE INDEX player_weap_stats_2011Q3_ix02 on player_weapon_stats_2011Q3(game_id);
54 CREATE INDEX player_weap_stats_2011Q3_ix03 on player_weapon_stats_2011Q3(player_id);
55 ALTER TABLE xonstat.player_weapon_stats_2011Q3 OWNER TO xonstat;
56
57 CREATE TABLE xonstat.player_weapon_stats_2011Q4 ( 
58     CHECK ( create_dt >= DATE '2011-10-01' AND create_dt < DATE '2012-01-01' ) 
59 ) INHERITS (player_weapon_stats);
60
61 CREATE INDEX player_weap_stats_2011Q4_ix01 on player_weapon_stats_2011Q4(create_dt);
62 CREATE INDEX player_weap_stats_2011Q4_ix02 on player_weapon_stats_2011Q4(game_id);
63 CREATE INDEX player_weap_stats_2011Q4_ix03 on player_weapon_stats_2011Q4(player_id);
64 ALTER TABLE xonstat.player_weapon_stats_2011Q4 OWNER TO xonstat;
65
66 -- 2012
67 CREATE TABLE xonstat.player_weapon_stats_2012Q1 ( 
68     CHECK ( create_dt >= DATE '2012-01-01' AND create_dt < DATE '2012-04-01' ) 
69 ) INHERITS (player_weapon_stats);
70
71 CREATE INDEX player_weap_stats_2012Q1_ix01 on player_weapon_stats_2012Q1(create_dt);
72 CREATE INDEX player_weap_stats_2012Q1_ix02 on player_weapon_stats_2012Q1(game_id);
73 CREATE INDEX player_weap_stats_2012Q1_ix03 on player_weapon_stats_2012Q1(player_id);
74 ALTER TABLE xonstat.player_weapon_stats_2012Q1 OWNER TO xonstat;
75
76 CREATE TABLE xonstat.player_weapon_stats_2012Q2 ( 
77     CHECK ( create_dt >= DATE '2012-04-01' AND create_dt < DATE '2012-07-01' ) 
78 ) INHERITS (player_weapon_stats);
79
80 CREATE INDEX player_weap_stats_2012Q2_ix01 on player_weapon_stats_2012Q2(create_dt);
81 CREATE INDEX player_weap_stats_2012Q2_ix02 on player_weapon_stats_2012Q2(game_id);
82 CREATE INDEX player_weap_stats_2012Q2_ix03 on player_weapon_stats_2012Q2(player_id);
83 ALTER TABLE xonstat.player_weapon_stats_2012Q2 OWNER TO xonstat;
84
85 CREATE TABLE xonstat.player_weapon_stats_2012Q3 ( 
86     CHECK ( create_dt >= DATE '2012-07-01' AND create_dt < DATE '2012-10-01' ) 
87 ) INHERITS (player_weapon_stats);
88
89 CREATE INDEX player_weap_stats_2012Q3_ix01 on player_weapon_stats_2012Q3(create_dt);
90 CREATE INDEX player_weap_stats_2012Q3_ix02 on player_weapon_stats_2012Q3(game_id);
91 CREATE INDEX player_weap_stats_2012Q3_ix03 on player_weapon_stats_2012Q3(player_id);
92 ALTER TABLE xonstat.player_weapon_stats_2012Q3 OWNER TO xonstat;
93
94 CREATE TABLE xonstat.player_weapon_stats_2012Q4 ( 
95     CHECK ( create_dt >= DATE '2012-10-01' AND create_dt < DATE '2013-01-01' ) 
96 ) INHERITS (player_weapon_stats);
97
98 CREATE INDEX player_weap_stats_2012Q4_ix01 on player_weapon_stats_2012Q4(create_dt);
99 CREATE INDEX player_weap_stats_2012Q4_ix02 on player_weapon_stats_2012Q4(game_id);
100 CREATE INDEX player_weap_stats_2012Q4_ix03 on player_weapon_stats_2012Q4(player_id);
101 ALTER TABLE xonstat.player_weapon_stats_2012Q4 OWNER TO xonstat;
102
103 -- 2013
104 CREATE TABLE xonstat.player_weapon_stats_2013Q1 ( 
105     CHECK ( create_dt >= DATE '2013-01-01' AND create_dt < DATE '2013-04-01' ) 
106 ) INHERITS (player_weapon_stats);
107
108 CREATE INDEX player_weap_stats_2013Q1_ix01 on player_weapon_stats_2013Q1(create_dt);
109 CREATE INDEX player_weap_stats_2013Q1_ix02 on player_weapon_stats_2013Q1(game_id);
110 CREATE INDEX player_weap_stats_2013Q1_ix03 on player_weapon_stats_2013Q1(player_id);
111 ALTER TABLE xonstat.player_weapon_stats_2013Q1 OWNER TO xonstat;
112
113 CREATE TABLE xonstat.player_weapon_stats_2013Q2 ( 
114     CHECK ( create_dt >= DATE '2013-04-01' AND create_dt < DATE '2013-07-01' ) 
115 ) INHERITS (player_weapon_stats);
116
117 CREATE INDEX player_weap_stats_2013Q2_ix01 on player_weapon_stats_2013Q2(create_dt);
118 CREATE INDEX player_weap_stats_2013Q2_ix02 on player_weapon_stats_2013Q2(game_id);
119 CREATE INDEX player_weap_stats_2013Q2_ix03 on player_weapon_stats_2013Q2(player_id);
120 ALTER TABLE xonstat.player_weapon_stats_2013Q2 OWNER TO xonstat;
121
122 CREATE TABLE xonstat.player_weapon_stats_2013Q3 ( 
123     CHECK ( create_dt >= DATE '2013-07-01' AND create_dt < DATE '2013-10-01' ) 
124 ) INHERITS (player_weapon_stats);
125
126 CREATE INDEX player_weap_stats_2013Q3_ix01 on player_weapon_stats_2013Q3(create_dt);
127 CREATE INDEX player_weap_stats_2013Q3_ix02 on player_weapon_stats_2013Q3(game_id);
128 CREATE INDEX player_weap_stats_2013Q3_ix03 on player_weapon_stats_2013Q3(player_id);
129 ALTER TABLE xonstat.player_weapon_stats_2013Q3 OWNER TO xonstat;
130
131 CREATE TABLE xonstat.player_weapon_stats_2013Q4 ( 
132     CHECK ( create_dt >= DATE '2013-10-01' AND create_dt < DATE '2014-01-01' ) 
133 ) INHERITS (player_weapon_stats);
134
135 CREATE INDEX player_weap_stats_2013Q4_ix01 on player_weapon_stats_2013Q4(create_dt);
136 CREATE INDEX player_weap_stats_2013Q4_ix02 on player_weapon_stats_2013Q4(game_id);
137 CREATE INDEX player_weap_stats_2013Q4_ix03 on player_weapon_stats_2013Q4(player_id);
138 ALTER TABLE xonstat.player_weapon_stats_2013Q4 OWNER TO xonstat;
139
140 -- 2014
141 CREATE TABLE xonstat.player_weapon_stats_2014Q1 ( 
142     CHECK ( create_dt >= DATE '2014-01-01' AND create_dt < DATE '2014-04-01' ) 
143 ) INHERITS (player_weapon_stats);
144
145 CREATE INDEX player_weap_stats_2014Q1_ix01 on player_weapon_stats_2014Q1(create_dt);
146 CREATE INDEX player_weap_stats_2014Q1_ix02 on player_weapon_stats_2014Q1(game_id);
147 CREATE INDEX player_weap_stats_2014Q1_ix03 on player_weapon_stats_2014Q1(player_id);
148 ALTER TABLE xonstat.player_weapon_stats_2014Q1 OWNER TO xonstat;
149
150 CREATE TABLE xonstat.player_weapon_stats_2014Q2 ( 
151     CHECK ( create_dt >= DATE '2014-04-01' AND create_dt < DATE '2014-07-01' ) 
152 ) INHERITS (player_weapon_stats);
153
154 CREATE INDEX player_weap_stats_2014Q2_ix01 on player_weapon_stats_2014Q2(create_dt);
155 CREATE INDEX player_weap_stats_2014Q2_ix02 on player_weapon_stats_2014Q2(game_id);
156 CREATE INDEX player_weap_stats_2014Q2_ix03 on player_weapon_stats_2014Q2(player_id);
157 ALTER TABLE xonstat.player_weapon_stats_2014Q2 OWNER TO xonstat;
158
159 CREATE TABLE xonstat.player_weapon_stats_2014Q3 ( 
160     CHECK ( create_dt >= DATE '2014-07-01' AND create_dt < DATE '2014-10-01' ) 
161 ) INHERITS (player_weapon_stats);
162
163 CREATE INDEX player_weap_stats_2014Q3_ix01 on player_weapon_stats_2014Q3(create_dt);
164 CREATE INDEX player_weap_stats_2014Q3_ix02 on player_weapon_stats_2014Q3(game_id);
165 CREATE INDEX player_weap_stats_2014Q3_ix03 on player_weapon_stats_2014Q3(player_id);
166 ALTER TABLE xonstat.player_weapon_stats_2014Q3 OWNER TO xonstat;
167
168 CREATE TABLE xonstat.player_weapon_stats_2014Q4 ( 
169     CHECK ( create_dt >= DATE '2014-10-01' AND create_dt < DATE '2015-01-01' ) 
170 ) INHERITS (player_weapon_stats);
171
172 CREATE INDEX player_weap_stats_2014Q4_ix01 on player_weapon_stats_2014Q4(create_dt);
173 CREATE INDEX player_weap_stats_2014Q4_ix02 on player_weapon_stats_2014Q4(game_id);
174 CREATE INDEX player_weap_stats_2014Q4_ix03 on player_weapon_stats_2014Q4(player_id);
175 ALTER TABLE xonstat.player_weapon_stats_2014Q4 OWNER TO xonstat;