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