]> de.git.xonotic.org Git - xonotic/xonstatdb.git/blob - tables/games.tab
Add alivetime and rank to player_game_stats table.
[xonotic/xonstatdb.git] / tables / games.tab
1 CREATE TABLE xonstat.games
2 (
3   game_id bigserial NOT NULL,
4   start_dt timestamp without time zone NOT NULL,
5   game_type_cd character varying(10) NOT NULL,
6   server_id integer NOT NULL,
7   map_id integer NOT NULL,
8   duration interval,
9   winner integer,
10   create_dt timestamp without time zone NOT NULL DEFAULT now(),
11   CONSTRAINT games_pk PRIMARY KEY (game_id),
12   CONSTRAINT games_fk001 FOREIGN KEY (game_type_cd)
13       REFERENCES xonstat.cd_game_type (game_type_cd) MATCH SIMPLE
14       ON UPDATE NO ACTION ON DELETE NO ACTION,
15   CONSTRAINT games_fk002 FOREIGN KEY (server_id)
16       REFERENCES xonstat.servers (server_id) MATCH SIMPLE
17       ON UPDATE NO ACTION ON DELETE NO ACTION,
18   CONSTRAINT games_fk003 FOREIGN KEY (map_id)
19       REFERENCES xonstat.maps (map_id) MATCH SIMPLE
20       ON UPDATE NO ACTION ON DELETE NO ACTION
21 )
22 WITH (
23   OIDS=FALSE
24 );
25 CREATE INDEX games_ix001 on games(create_dt);
26 ALTER TABLE xonstat.games OWNER TO xonstat;
27
28 CREATE TABLE xonstat.games_2011Q2 (
29     CHECK ( create_dt >= DATE '2011-04-01' AND create_dt < DATE '2011-07-01' ) 
30 ) INHERITS (games);
31 CREATE INDEX games_2011Q2_ix001 on games_2011Q2(create_dt);
32 ALTER TABLE xonstat.games_2011Q2 OWNER TO xonstat;
33
34 CREATE TABLE xonstat.games_2011Q3 ( 
35     CHECK ( create_dt >= DATE '2011-07-01' AND create_dt < DATE '2011-10-01' ) 
36 ) INHERITS (games);
37 CREATE INDEX games_2011Q3_ix001 on games_2011Q3(create_dt);
38 ALTER TABLE xonstat.games_2011Q3 OWNER TO xonstat;
39
40 CREATE TABLE xonstat.games_2011Q4 ( 
41     CHECK ( create_dt >= DATE '2011-10-01' AND create_dt < DATE '2012-01-01' ) 
42 ) INHERITS (games);
43 CREATE INDEX games_2011Q4_ix001 on games_2011Q4(create_dt);
44 ALTER TABLE xonstat.games_2011Q4 OWNER TO xonstat;
45
46 CREATE TABLE xonstat.games_2012Q1 ( 
47     CHECK ( create_dt >= DATE '2012-01-01' AND create_dt < DATE '2012-04-01' ) 
48 ) INHERITS (games);
49 CREATE INDEX games_2012Q1_ix001 on games_2012Q1(create_dt);
50 ALTER TABLE xonstat.games_2012Q1 OWNER TO xonstat;
51
52 CREATE TABLE xonstat.games_2012Q2 ( 
53     CHECK ( create_dt >= DATE '2012-04-01' AND create_dt < DATE '2012-07-01' ) 
54 ) INHERITS (games);
55 CREATE INDEX games_2012Q2_ix001 on games_2012Q2(create_dt);
56 ALTER TABLE xonstat.games_2012Q2 OWNER TO xonstat;
57
58 CREATE TABLE xonstat.games_2012Q3 ( 
59     CHECK ( create_dt >= DATE '2012-07-01' AND create_dt < DATE '2012-10-01' ) 
60 ) INHERITS (games);
61 CREATE INDEX games_2012Q3_ix001 on games_2012Q3(create_dt);
62 ALTER TABLE xonstat.games_2012Q3 OWNER TO xonstat;
63
64 CREATE TABLE xonstat.games_2012Q4 ( 
65     CHECK ( create_dt >= DATE '2012-10-01' AND create_dt < DATE '2013-01-01' ) 
66 ) INHERITS (games);
67 CREATE INDEX games_2012Q4_ix001 on games_2012Q4(create_dt);
68 ALTER TABLE xonstat.games_2012Q4 OWNER TO xonstat;
69
70 CREATE TABLE xonstat.games_2013Q1 ( 
71     CHECK ( create_dt >= DATE '2013-01-01' AND create_dt < DATE '2013-04-01' ) 
72 ) INHERITS (games);
73 CREATE INDEX games_2013Q1_ix001 on games_2013Q1(create_dt);
74 ALTER TABLE xonstat.games_2013Q1 OWNER TO xonstat;
75
76 CREATE TABLE xonstat.games_2013Q2 ( 
77     CHECK ( create_dt >= DATE '2013-04-01' AND create_dt < DATE '2013-07-01' ) 
78 ) INHERITS (games);
79 CREATE INDEX games_2013Q2_ix001 on games_2013Q2(create_dt);
80 ALTER TABLE xonstat.games_2013Q2 OWNER TO xonstat;