]> de.git.xonotic.org Git - xonotic/xonstatdb.git/blob - tables/games.tab
Add the duel game type.
[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 character varying(64),
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   CONSTRAINT games_uk001 UNIQUE KEY (server_id, match_id)
23 )
24 WITH (
25   OIDS=FALSE
26 );
27 CREATE INDEX games_ix001 on games(create_dt);
28 ALTER TABLE xonstat.games OWNER TO xonstat;
29
30 CREATE TABLE xonstat.games_2011Q2 (
31     CHECK ( create_dt >= DATE '2011-04-01' AND create_dt < DATE '2011-07-01' ) 
32 ) INHERITS (games);
33 CREATE INDEX games_2011Q2_ix001 on games_2011Q2(create_dt);
34 ALTER TABLE xonstat.games_2011Q2 OWNER TO xonstat;
35
36 CREATE TABLE xonstat.games_2011Q3 ( 
37     CHECK ( create_dt >= DATE '2011-07-01' AND create_dt < DATE '2011-10-01' ) 
38 ) INHERITS (games);
39 CREATE INDEX games_2011Q3_ix001 on games_2011Q3(create_dt);
40 ALTER TABLE xonstat.games_2011Q3 OWNER TO xonstat;
41
42 CREATE TABLE xonstat.games_2011Q4 ( 
43     CHECK ( create_dt >= DATE '2011-10-01' AND create_dt < DATE '2012-01-01' ) 
44 ) INHERITS (games);
45 CREATE INDEX games_2011Q4_ix001 on games_2011Q4(create_dt);
46 ALTER TABLE xonstat.games_2011Q4 OWNER TO xonstat;
47
48 CREATE TABLE xonstat.games_2012Q1 ( 
49     CHECK ( create_dt >= DATE '2012-01-01' AND create_dt < DATE '2012-04-01' ) 
50 ) INHERITS (games);
51 CREATE INDEX games_2012Q1_ix001 on games_2012Q1(create_dt);
52 ALTER TABLE xonstat.games_2012Q1 OWNER TO xonstat;
53
54 CREATE TABLE xonstat.games_2012Q2 ( 
55     CHECK ( create_dt >= DATE '2012-04-01' AND create_dt < DATE '2012-07-01' ) 
56 ) INHERITS (games);
57 CREATE INDEX games_2012Q2_ix001 on games_2012Q2(create_dt);
58 ALTER TABLE xonstat.games_2012Q2 OWNER TO xonstat;
59
60 CREATE TABLE xonstat.games_2012Q3 ( 
61     CHECK ( create_dt >= DATE '2012-07-01' AND create_dt < DATE '2012-10-01' ) 
62 ) INHERITS (games);
63 CREATE INDEX games_2012Q3_ix001 on games_2012Q3(create_dt);
64 ALTER TABLE xonstat.games_2012Q3 OWNER TO xonstat;
65
66 CREATE TABLE xonstat.games_2012Q4 ( 
67     CHECK ( create_dt >= DATE '2012-10-01' AND create_dt < DATE '2013-01-01' ) 
68 ) INHERITS (games);
69 CREATE INDEX games_2012Q4_ix001 on games_2012Q4(create_dt);
70 ALTER TABLE xonstat.games_2012Q4 OWNER TO xonstat;
71
72 CREATE TABLE xonstat.games_2013Q1 ( 
73     CHECK ( create_dt >= DATE '2013-01-01' AND create_dt < DATE '2013-04-01' ) 
74 ) INHERITS (games);
75 CREATE INDEX games_2013Q1_ix001 on games_2013Q1(create_dt);
76 ALTER TABLE xonstat.games_2013Q1 OWNER TO xonstat;
77
78 CREATE TABLE xonstat.games_2013Q2 ( 
79     CHECK ( create_dt >= DATE '2013-04-01' AND create_dt < DATE '2013-07-01' ) 
80 ) INHERITS (games);
81 CREATE INDEX games_2013Q2_ix001 on games_2013Q2(create_dt);
82 ALTER TABLE xonstat.games_2013Q2 OWNER TO xonstat;